To restore the original image dimension after applying masks.

10 ビュー (過去 30 日間)
Noor Afridi
Noor Afridi 2020 年 9 月 28 日
コメント済み: Walter Roberson 2020 年 9 月 28 日
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???

採用された回答

Walter Roberson
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 件のコメント
Noor Afridi
Noor Afridi 2020 年 9 月 28 日
Thank you Sir for your help
it help me alot. i also find other solution too.
Walter Roberson
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!

Translated by