Results 1 to 18 of 18

Thread: capture image from webcam and customize

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jan 2013
    Posts
    1

    capture image from webcam and customize

    Hi everyone,

    I need help please.

    can anyone tell me how to capture image from webcam and display in the picturebox.
    after that how to add a picture frame on top of the captured image.
    and then save to desired location.

    please advise.

    Regards,

    Kawin

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: capture image from webcam and customize

    Does your webcam allow you to save as jpg?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    Google capwin.zip I retreived this VB program, put it into VB2010 and it ran. It will show you how to use the AVIcap.dll to capture an image. Unfortunately, the only resolution I can get is 640X480.

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    Er, VB2010? You mean Visual Fred, not Visual Basic which this question was about.

    There should be plenty of AVICap examples in the CodeBank.

    From there stamping an overlay image ("frame") and saving as JPEG, PNG, or whatever has several possible answers.

  5. #5
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    Visual Fred???? What do you mean?

    Does anybody know how to get AVIcap to display a webcam at a resolution than 640 X 480?

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    The thing called "Visual Basic .Net" is so radical a departure from what had been known as Visual Basic for a decade that people felt it should have a different name. As you can see recycling the name has caused no end of comfusion: "VB2010" discussions don't belong here, they go in the VB.Net forum sections instead.

    Unless you want to scale the image after capture then you are limited to resolutions your camera supports. Part of setting up capture is requesting the resolution you want, but it must be valid for your camera.

  7. #7
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    I see. I started with VB6 years ago and just followed it along as it went over to the .net thing.

    I have a high resolution webcam, the Logitec pro 9000 that captures at 1600 X 1200. However the AVIcap.dll only seems to capture at 640 X 480. There must be a better dll somewhere. The Logitech webcam application does display at 1600 X 1200 but not full screen and full screen is what I want. I have emailed to Logitech but received no answer as yet.

    I will move over to the vb.net forum.

  8. #8
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: capture image from webcam and customize

    There used to be an EZvidc60.ocx for webcams on VB6 on http://www.shrinkwrapvb.com but its no longer available. If you want a copy let me know?

    You can Google EZvidc60.ocx but there was more instructions in the app.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  9. #9
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    Keith,
    I downloaded ezvid60.ocx from the Internet. I hope there is documentation available. Also, does this work with all webcams and will it support higher resolution than 640X480?

    I give it a try.

    thanks

  10. #10
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    The image sizes you can capture depends almost entirely on what your webcam supports. I plugged in an ancient cheapie LogiTech for testing and it only supports VGA (640x480) and QVGA (320*240).


    The demo project (attached) shows some of the things you are in for. There is quite a bit involved in using AviCap properly, and then there are the issues involved in doing further image processing as the O.P. asked about.

    All of this can be far less work to program if you use helper libraries built for the purpose.


    I wrote this by cobbling together some existing modules, trying to avoid as many run time dependencies as possible. At design and compile time it needs Edanmo's olelib.tlb (which needs to be registered). You can find that here.

    It also uses the GdiPlus library but that's included in all versions of 32- and 64-bit Windows except the earliest unupdated Windows 95.


    This demo uses QVGA resolution and presents a preview window. You can click on the "Take Snap" button to grab the current frame. At that point it takes an overlay image from a Visible = False PictureBox and stamps it on top of the captured frame with transparency, and converts the resulting raw bitmap to a JPEG file image in memory.

    This JPEG is shoehorned into a StdPicture which is assigned to a visible PictureBox for viewing. Then you can click on "Save JPEG" to save the image as a file.


    As you can see in the screenshot, this is an older and now "noisy" webcam and I was using it in fairly low light. The result is quite grainy so I held up a hand to help show something recognizable. A webcam in better condition and better light produces vastly better results of course.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by dilettante; Jan 11th, 2013 at 10:00 PM.

  11. #11
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    I have downloaded the files, CamSnap emo.zip, and the olelib.tib and will give it a try tomorrow.
    My webcam is a logitech pro 9000 with 1600X1200 resolution.
    Do you think I will get this resolution with this software?
    I am going to try.
    Thanks

  12. #12
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    You'll have to make some adjustments because as it is the CamSnap control and the Framed view PictureBox are side by side making it hard to make the form big enough for both.

    You could just skip the Framed view though since that was part of answering the original question before you hijacked the thread.

  13. #13
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    Here is another demo using the same CamSnap control, but chopping out the support for the overlay stamping, etc. Trying in better light with the same cruddy old webcam in this screenshot (below).

    Trying this on another system with a newer low cost 5MP USB webcam by Kinobo (Origami) I had no problems at the following resolutions:


    160x120, 320x240, 640x480, and 1280x960.


    I have no reason to think a higher resolution webcam wouldn't work beyond this too. People who claim that AviCap is limited to 640x480 are using it incorrectly or are simply wrong.
    Attached Images Attached Images  
    Attached Files Attached Files

  14. #14
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    Added a minor update and retested with that Kinobo Origami at 1600x1200 pixel resolution. Worked just fine.

    The changes were just (a.) added a few more resolutions to the menu, and (b.) when the selected resolution exceeds the monitor dimensions the CamSnap control itself (and thus the visible preview) and the Form are scaled down to fit the monitor better.

    The actual capture is done at the full selected resolution. When I tested this the saved JPEG was indeed 1600x1200 pixels.


    As a reminder, this approach to capture does not use the frequently seen hack that runs the image through the clipboard. That works - but is always a bit dicey since the clipboard should really only be used for user-initiated clip requests and not just as a quick hack to make a program work.


    While the OP never came back and barryj may have lost interest I hope this helps anyone coming upon the thread later. I hate to leave people hanging.
    Attached Files Attached Files

  15. #15
    New Member
    Join Date
    Jan 2013
    Posts
    12

    Re: capture image from webcam and customize

    I have not lost interest! I started installing VB6 on my Win 7 computer and has some issues. Also, after looking at the files, I realized that I might be just over my head in this effort. I have done a lot of VB programming but not near the complexity that I see here.

    Can CamSnap be compiled into an exe program that will run out of the box??? (hint, hint)

  16. #16
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    I'll add the note that none of this was tested with display settings below 24-bits per pixel. The logic used in these programs and their CamSnap control and helper classes makes assumptions about having 24-bit bitmaps to work with.

    Thus a system set to "hi-color" (16-bit, 15-bit) pixel depths may well fail.


    Update: I tried setting my display to 16-bit color and these programs seem to work just fine. One less issue.

  17. #17
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    Quote Originally Posted by barryj View Post
    I have not lost interest! I started installing VB6 on my Win 7 computer and has some issues. Also, after looking at the files, I realized that I might be just over my head in this effort. I have done a lot of VB programming but not near the complexity that I see here.

    Can CamSnap be compiled into an exe program that will run out of the box??? (hint, hint)
    Sorry, I had originally typed that your interest was dampened by some VB6 installation issues and then I cut that part out to simplify my post.


    The demo programs can of course be compiled but I'm not sure any of them do exactly what you need in a finished product. That's why they are demos.

    The CamSnap control could also be compiled along with those helper classes into an OCX file. But to use that you'd still need VB6 working.

  18. #18
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: capture image from webcam and customize

    BTW:

    I've attached a shot at 1600x1200 saved at 70% JPEG Quality taken with a $12 USB webcam.

    This camera is fixed-focus at normal portrait distance, and even has a weather cover over its lens. While I'd rather have the focus out at more like 30 to 40 feet it works well enough for its normal purpose which is 640x480 stills and streaming as a climate view. It's built into a birdhouse weather station with other USB instrumentation.

    With all of those issues, the bark of the tree in the left of this scene shows pretty decent subjective quality (and yes, the lighting was very good here). For a fair judgement you might want to right-click/Save the image for viewing, it shows reduced embedded here.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width