In the machine vision system, data acquisition is the first step which programmer should aware. You want to preview object using your camera, capture it, store the captured image in your PC? With simple way, you will get your own preview window of your webcam by following this tutorial.
Equipments:
- CCD camera & frame grabber or webcame
- PC with MATLAB 7.x
- Make sure that you have a functional CCD camera or webcam connected to your PC. Functional means it's driver has been installed in your PC. To see whether your camera can work well or not, you can install a windows standard video capture, named AMCAP.
- MATLAB has built-in adaptor to communicate with the acquisition device. To check whether your MATLAB has this support or not, type
>> cam=imaqhwinfo
cam =
InstalledAdaptors: {1x1 cell}
MATLABVersion: [1x12 char]
ToolboxName: [1x25 char]
ToolboxVersion: [1x12 char]
>> cam.InstalledAdaptors
ans =
'winvideo'
For more information about your device, type
>> device_info=imaqhwinfo('winvideo',1)
- Type the following code in your editor and run the program
vid=videoinput(‘winvideo’);
preview(vid)
im=getsnapshot(vid)
imshow(im)
Check your workspace, now you have RGB image data im.
- To store the image data to a .jpg or .gif file, type
imwrite(im,’myimet.jpg’);
Very easy? If you face any problem or you have suggestions, do not hesitate to write in the comments area below.
3 comments:
hi plz i wanted to ask you how can i do so using w specific time or specific number of frames
plz answer me asap :)
thnx a lot
I am doing a project on controlling computer mouse through eye movement and I need a suitable camera for my project. The camera should be capable of tracking the eye movements. Are there any specific cameras that a economical and meet my requirements? Are the Firewire cameras the only choice?
Hi, just wanna ask if this feature of matlab can work with CCTV cameras as well? tnx.
Post a Comment