imshowpair() - Image Processing
h = imshowpair(A,B)
creates a visualization of the differences between images A and B.
If A and B are different sizes, imshowpair pads
the smaller dimensions with zeros on the bottom and right edges so
that the two images are the same size. h is a
handle to the HG image object created by imshowpair.exampleh = imshowpair(A,RA,B,RB)
displays the differences between images A and B,
using the spatial referencing information provided in RA and RB.
RA and RB are spatial referencing
objects.exampleh = imshowpair(___,method) uses
the visualization method specified by method.exampleh = imshowpair(___,Name,Value) specifies
additional options with one or more Name,Value pair
arguments, using any of the previous syntaxes.
Syntax
h = imshowpair(A,B) exampleh = imshowpair(A,RA,B,RB) exampleh = imshowpair(___,method) exampleh = imshowpair(___,Name,Value) example
Example
Display Two Images That Differ by Rotation Offset
Display a pair of grayscale images with two
different visualization methods, 'diff' and 'blend'.
Load an image into the workspace. Create a copy with a
rotation offset applied.A = imread('cameraman.tif');
B = imrotate(A,5,'bicubic','crop');
Display the difference of A and B.imshowpair(A,B,'diff');
Display a blended overlay A and B.figure;
imshowpair(A,B,'blend','Scaling','joint');
Display Two Spatially Referenced Images with Different Brightness RangesRead an image. Create a copy and apply rotation and a
brightness adjustment.A = dicomread('CT-MONO2-16-ankle.dcm');
B = imrotate(A,10,'bicubic','crop');
B = B * 0.2;
In this case, we know that the resolution of images A and B is
0.2mm. Provide this information using two spatial referencing objects.RA = imref2d(size(A),0.2,0.2);
RB = imref2d(size(B),0.2,0.2);Display the images with the default method ('falsecolor')
and apply brightness scaling independently to each image. Specify
the axes that will be the parent of the image object created by imshowpair.figure;
hAx = axes;
imshowpair(A,RA,B,RB,'Scaling','independent','Parent',hAx);
Output / Return Value
Limitations
Alternatives / See Also
Reference