Using indexing to superimpose images:
1 次查看(过去 30 天)
显示 更早的评论
Hello, I was wondering if someone could help me. I am trying to superimpose images so that both images are visible. I have found the perfect example at the address below. I am using second lot of code (using indexing) as i want a single image as a result that is easily saved.
I have simply cut and paste the code from section 2 but it does not seem to work. There is no error and a figure is displayed with the images but it looks like the images have been overlayed without any of the pixels from the underlying image showing through.
Just wanted to see if this example has worked for others or maybe something is wrong at my end.
I am using matlab 7.1 with the image processing toolbox
Regards Dana
0 个评论
采纳的回答
Amith Kamath
2011-11-2
From the description on the link you posted:
Use this method if you have an image that you want to place in a scene, but prefer to have only a single image as a resultant. The following example achieves this by replacing the scene pixels with the object image pixels.
So I'm guessing it is doing what it is meant to do! but if you want the underlying pixels to be shown too, you need to edit:
result((1:size(obj,1))+rowshift, (1:size(obj,2))+colshift, :) = 0.25.*obj + 0.25.*scene((1:size(obj,1))+rowshift, (1:size(obj,2))+colshift, :);
in the part where result is assigned the pixel values. Note that the 0.25 scaling is just so that the index values don't go > 1.
Hope this helps!
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!