MIsmatch between left and right side

조회 수: 3 (최근 30일)
Rd
Rd 2020년 7월 17일
답변: Image Analyst 2020년 7월 17일
img = im2double(imread('veinvein.jpg')); % Read the image
img = imresize(img,0.5); % Downscale image
fvr = lee_region(img,4,20);
edges = zeros(2,img_w);
edges(1,:) = y_up;
edges(2,:) = round(y_lo + size(img_filt_lo,1));
It shows mismatch while run the above code
ERRORS:
Unable to perform assignment because the size of the left side is 1-by-161 and the size of the right side is 1-by-483.
Error in lee_region (line 61)
edges(1,:) = y_up;
Error in feature (line 11)
fvr = lee_region(img,4,20); % Get finger region

채택된 답변

Image Analyst
Image Analyst 2020년 7월 17일
What is img_w and y_up? How did you get img_w (I'm guessing you used the size() function incorrectly for an image).
So, since the 2-D matrix "edge" has 161 columns in it, why do you think you can stuff 483 elements into it?
Strangely enough 483 is 3 times 161, so it further substantiates my guess you incorrectly did
[img_h, img_w] = size(img);
instead of the more correct:
[img_h, img_w, numberOfColorChannels] = size(img);
So if it's a color image, your img_w would be 3 times what you expect, which is exactly what's happening.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by