cover another image by multiple image with exactly position ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jenifer NG
el 16 de Mayo de 2022
Comentada: Image Analyst
el 17 de Mayo de 2022
Dear All,
I am doing my study thesis and I got problem that I don't know how to overlay current image to other image with exactly position.
The position was generate when i detect the centroid. (it can be seen in the stat variable in workspace after run my code)
Could any expert help me please ?
another image is 'Original.jpg' that i attached to this post
This is my code:
Ibw = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/999460/finalmask.png');
stat = regionprops(Ibw,'Centroid');
imread(("https://www.mathworks.com/matlabcentral/answers/uploaded_files/999465/original.jpg"));
imshow(imread(("https://www.mathworks.com/matlabcentral/answers/uploaded_files/999465/original.jpg")))
hold on;
N=numel(stat);
for i=1:N
stat(i).BoundingBox=[stat(i).Centroid-32.5, 63,63];
plot(stat(i).Centroid(1),stat(i).Centroid(2),'+',LineWidth=2);
end
hold off
I2=imread("https://www.mathworks.com/matlabcentral/answers/uploaded_files/999465/original.jpg")
subimages=arrayfun(@(s)imcrop(I2,s.BoundingBox), stat,'uni',0); %You can use a new image here
montage(subimages,'Back','w','Bor',0)
for k = 1:N
b{k}=cell2mat(subimages(k,1))
filename=sprintf('image0%d.jpg',k)
imwrite(b{k},filename)
end
Thanks and Regards
Han
0 comentarios
Respuesta aceptada
Image Analyst
el 16 de Mayo de 2022
2 comentarios
Image Analyst
el 17 de Mayo de 2022
If you don't have a binary image then imoverlay would not be what you want. If you have gray scale images then you may just want to paste them onto the image, covering up what was there before. See attached demo.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!