Posts

Showing posts with the label matlab image

Take Snapshots Using WebCam in MATLAB

Image
In this post, I am going, open webcam capture image save the captured image  using MATLAB. As the first step, we want to install the support tool. So we have to click "Add-Ons." After that, we have to select "Get Hardware Support Packages." Next, we have to search for  MATLAB Support Package for USB Webcams  and install it. (before installing Add-Ons, you want to log in to MATLAB)  After installing the support tool, You can use these codes. captureimg.m clear; cam = webcam; %start webcam cam.Resolution = '640x360'; %resize the webcam resolution preview(cam); %preview the webcam pause(5); %pause the webcam img = snapshot(cam); %take snapshot closePreview(cam); %close the preview screen imshow(img); %show the image savecapture(img); %call function savecapture clear; %stop the webcam savecapture.m function savecapture(img)     persistent k %static value k for naming variables      if isempty(k) ...