To restore the original image dimension after applying masks.
10 次查看(过去 30 天)
显示 更早的评论
Hello Sir,
How to get the original image dimension , when i apply
mask = img >= 190 & img <= 226;
img( mask) =255
my images size is 712x1825 uint8, some are greater than 3000 , matlb does give me my original size of the image,
when i resize the image" img = imresize(I, 0.4 )" after getting output of the images. I want to take the precision , recall and F_measure with ground_thruth of the dataset, it gives me the error "Matrix dimensions must agree.".. Now my question is that after apply mask how get the original size or dimension of the images???
0 个评论
采纳的回答
Walter Roberson
2020-9-28
Your code to apply the mask to img does not change the size of img.
If you need to get out something that is the size of I after you did
img = imresize(I, 0.4);
mask = img >= 190 & img <= 226;
img( mask) =255
then proceed to
img_I_sized = imresize(img, [size(I,1), size(I,2)]);
4 个评论
Walter Roberson
2020-9-28
it givee the following warning , which effect my precision , recall and F1
That warning has absolutely no effect on your precision, recall, or F1 calculations. It is telling you that when you did the imshow() that the image was larger than your available monitor size, so it has scaled the visual image down to fit on the screen. The content of your image arrays has not been changed.
imshow() has nothing to do with saving images... not unless the way you are saving images is to imshow() and then use the menu to Save the image as a file.
If i wanna save the image without resizing
imwrite() the array. You do not need to display it to imwrite() it.
imwrite(img, 'YourOutputFileNameGoesHere.png');
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!