I need to layer 2 images so I can select the same region of both images at once
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am comparing optical densities of film. I have one film that was scanned pre-exposure and after exposure (1 film, 2 images).
I need to compare the optical densities of the two different images relative to the same region.
I was curious if it would be possible to layer the two images or create an array that is something like MxNx2 with img1=(M,N,1) and img2=(M,N,2).
When I display the array, I only need to see the exposed film. But when I select a region from the image, I need perform calculations on that region for both layers. So basically I need to select the region and get an array variable for the top layer and a different variable of the same size and location for the bottom layer that isnt being displayed
Questions, comments, suggestions?
0 commentaires
Réponses (2)
Image Analyst
le 19 Déc 2011
You can use roipolyold() or imfreehand() to draw regions on the image. The image could be just one of the images, or it could be where you averaged the images together,
averageImage = (single(image1)+single(image2))/2;
or it could be where you put each image into one color channel:
rgbImage = cat(3, image1, zeros(size(image1)), image2);
Then you can convert the coordinates of the region you drew into a binary image with poly2mask(). Then extract the pixels in the region from each image
image1ROI = image1(binaryImageMask); % A linear 1D vector.
image2ROI = image2(binaryImageMask);
Justin
le 30 Déc 2011
1 commentaire
Image Analyst
le 30 Déc 2011
How did you "get it"? That doesn't do anything like the "layering" you asked for. No average image, no color image with each gray image as a color channel. Nothing at all like you asked me initially. All you're doing it cropping two images at the same locations. Anyway, you might find rbbox() easier to use than imrect().
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!