aligning overlapping images and averaging the overlap
显示 更早的评论
i have an empty matrix
canvas = uint8(zeros(10));
images are placed inside
image1=uint8(magic(3));
canvas(2:4,2:4)=image1;
a second image obviously overwrites the first
image2=uint8(magic(3));
canvas(3:5,3:5)=image2;
I would like to average the overlapping region
my attempt was to inspect each element in canvas to see if it was zero or non zero and then average each element(of subsequent images) one by one if it was non zero. sadly my code is really slow and doesn't work properly..
please help
采纳的回答
更多回答(3 个)
Sean de Wolski
2011-3-10
0 个投票
To start: -use CONV2 with a ones kernel to figure out how many zeros are touching.
2 个评论
james
2011-3-10
Sean de Wolski
2011-3-10
No, since your above code "doesn't work" for you. I would guess what is wrong with your above code is that you're updating things and then checking the updates but I don't really know. CONV will do the averaging for you; you can use logical indexing to find if an element is zero. I don't totally understand what you're trying to do though, so more explanation would be better.
james
2011-3-10
2 个评论
Sean de Wolski
2011-3-10
You do realize that the it will add image2 twice since you're using two if statements not an else-if statement right?
james
2011-3-10
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!