MATLAB: MIsmatch between left and right side

Image Processing Toolboxmismatchsize;using size() improperly for an image

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

Best Answer

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.