MATLAB: Undefined function snapshot for input arguments of type ‘uint8’

snapshotundefined function

I have a code in which I need to use mobile as ipweb cam to take a single image.
url='http://192.168.43.1:8080/shot.jpg';
cam = imread(url);
img= snapshot(cam);
imshow(img);
fullFileName= fullfile('C:\Users\USER\Desktop\final year project\FFF', '.jpg');
imwrite(img,fullFileName);
clear cam;
BUt I am getting an error saying undefined function 'snapshot' for input arguments of type 'uint8'. I am using matlab2014a.

Best Answer

Did you read the documentation already? doc snapshot. You have to create the "cam" object e.g. by cam = webcam('Logitech'). In your code, the image is obtained by imread(url) already, so simply replace:

cam = imread(url);
img= snapshot(cam);
imshow(img);

by

img = imread(url);
imshow(img);
Related Question