how to read an imagecaptured by webcam
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
%webcamlist
cam = webcam('Integrated Webcam');
preview(cam);
closePreview(cam)
img = snapshot(cam);
imshow(img)
%image(img)
clear('cam');
I = imread(img);
srcFiles1 = dir('C:\b\*.bmp');
for j = 1 : length(srcFiles1)
filename1 = strcat('C:\b\',srcFiles1(j).name);
I2 = imread(filename1);
points = detectSURFFeatures(I);
length(points)
points2 = detectSURFFeatures(I2);
length(points2)
[features1, validPoints1] = extractFeatures(I, points);
[features2, validPoints2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(features1, features2);
matchedPoints1 = validPoints1(indexPairs(:, 1), :);
matchedPoints2 = validPoints2(indexPairs(:, 2), :);
showMatchedFeatures(I, I2, matchedPoints1, matchedPoints2, 'montage');
figure;
end
%end
output:
Error using imread>parse_inputs (line 450)
The file name or URL argument must be a character vector.
Error in imread (line 322)
[filename, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});
Error in acquire (line 13)
[X, map] = imread(img);
Error using imread>parse_inputs (line 450)
The file name or URL argument must be a character vector.
Error in imread (line 322)
[filename, fmt_s, extraArgs, was_cached_fmt_used] = parse_inputs(cached_fmt, varargin{:});
Error in acquire (line 13)
[X, map] = imread(img);
i have captured an image using webcam and then am trying to compare this image with the images in the database.why is matlab unable to read image file?
0 Kommentare
Antworten (1)
Cris LaPierre
am 1 Apr. 2019
Bearbeitet: Cris LaPierre
am 1 Apr. 2019
I think the issue here is that img is not a file, but a matrix of pixel values already. You therefore don't need to use imread to read it. It's already been 'read' in.
Try just using I=img;
2 Kommentare
Cris LaPierre
am 1 Apr. 2019
Please share the entire error message. Would be nice to also include a sample image that produces this error.
Siehe auch
Kategorien
Mehr zu Microscopy finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!