Combine /fuse two images into one
6 次查看(过去 30 天)
显示 更早的评论
Hi all
I have two images . I want to combine them into one image .1st images has a size of 512x271
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190627/image.jpeg)
and the second image has a size of 512x271x512
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190628/image.jpeg)
I want to combine them into one image with size of 512x271x512 like last image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190629/image.jpeg)
but I don't know how I can do this . I have used imfuse but its not working for me . any one help me in tis matter
0 个评论
采纳的回答
Walter Roberson
2018-5-18
im1 = imread('one.JPG');
other_images = .... whatever is needed to read your 512x271x512 into an array
blend = 0.2;
mask1 = imbinarize(im1);
fused = other_images;
for slice = 1 : size(fused, 3)
this_slice = fused(:,:,slice);
this_slice(mask1) = this_slice(mask1) * (1-blend) * im1(mask1);
fused(:,:,slice) = this_slice;
end
Here, blend is the portion of the image that should be used at those locations, rather than just overwriting the pixels with the white line.
9 个评论
Walter Roberson
2018-5-18
The fused image should be making the edge in white unless your im1 is not really a JPEG image or unless your other_images is int16 or uint16 with a high range.
What is class(im1) and class(other_images) and max(im1(:)) and max(other_images(:)) ?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!