To restore the original image dimension after applying masks.

5 visualizzazioni (ultimi 30 giorni)
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???

Risposta accettata

Walter Roberson
Walter Roberson il 28 Set 2020
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 Commenti
Noor Afridi
Noor Afridi il 28 Set 2020
Thank you Sir for your help
it help me alot. i also find other solution too.
Walter Roberson
Walter Roberson il 28 Set 2020
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');

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by