Borrar filtros
Borrar filtros

Imshowpair displaying differently from Imshow

19 visualizaciones (últimos 30 días)
Andrew Mizener
Andrew Mizener el 7 de Nov. de 2018
Respondida: MichailM el 8 de Mzo. de 2020
I am using imshowpair to show the difference between a raw image and one to which I have applied edge detection. However, the "raw" image displays differently in imshowpair than it does when I open it with imshow. Here is the code I am using; the image I'm analyzing is attached to this post:
I = imread('Camera_20_08_23_121.bmp');
figure
imshow(I)
BW_canny = edge(I,'canny');
figure;
imshowpair(I,BW_canny,'montage')
title('Unfiltered Canny Filter');
This is the image created with imshow:
And this is the image created with imshowpair:
The image on the left in the latter example appears to have been contrast-enhanced in some way, but I can't find anything in the documentation on what might have caused the difference. The left-side image could be of use to me, so I'd like to try and create that image by itself using imshow (i.e. unlinked to an imshowpair command).
Therefore, my questions are twofold, and possibly linked:
  1. What did imshowpair do to the image to modify it?
  2. How can I reproduce the image on the left side of the imshowpair example programmatically so that I can display just that image by itself?
Note: I have tried converting the original image to a binary one using the mean-value method from the imshow documentation, but the result is not the same as the left-side imshowpair figure, which appears to still be grayscale.

Respuestas (3)

Arpit Aggarwal
Arpit Aggarwal el 5 de Mzo. de 2019
To replicate the results of imshowpair with imshow, do the following:
% If I is the image
imshow(I, [min(I(:)) max(I(:))])
  1 comentario
Ugur Kahveci
Ugur Kahveci el 17 de En. de 2020
I had the same issue and this helped me solve it. Thank you

Iniciar sesión para comentar.


MichailM
MichailM el 8 de Mzo. de 2020
I had the same problem with the imshowpair() function. The imshowpair seems to shift the image bits to the left while imshow does not. Although the solution is pretty simple
imshowpair(I,BW_canny,'montage','Scaling','none')

KALYAN ACHARJYA
KALYAN ACHARJYA el 7 de Nov. de 2018
Editada: KALYAN ACHARJYA el 7 de Nov. de 2018
Please note:
I = imread('Camera_20_08_23_121.bmp');
here I is a gray image
on the other statement
BW_canny = edge(I,'canny');
Here BW_canny is a binary image.
If you do the following :
I=imread('Camera_20_08_23_121.bmp');
figure,imshow(I)
BW_canny=edge(I,'canny');
figure;
imshowpair(im2bw(I),BW_canny,'montage')
title('Unfiltered Canny Filter');
Please note on imshowpair line, I have converted I to binary im2bw(I)
  2 comentarios
Andrew Mizener
Andrew Mizener el 7 de Nov. de 2018
This is all true, but does not answer either of my questions.
KALYAN ACHARJYA
KALYAN ACHARJYA el 7 de Nov. de 2018
Sir, read this one>>
By default, imshowpair scales the intensity values of A and B independently from each other. imshowpair returns obj, an image object.

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by