How to overlap multiple pictures
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hallo,
I created multiple pictures with the same size like: White (background), colored lines (foreground)
How do I read all of them in and than - How can I overlap all pictures that I red in forming one image in the end?
Images like: ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/473678/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/473678/image.jpeg)
0 Kommentare
Antworten (1)
Image Analyst
am 29 Dez. 2020
I think you're best off creating then from the images you got from bwperim(). Use those images with ind2rgb() to create an RGB image, and just assign the color for the latest image to a running total image. If you want the black to then become white you can get a mask of all pure black areas and set them all to 255. But if you really want to start with these existing white and colored images, you can do (as a start)
masterImage = zeros(rows, columns, 3, 'uint8');
[rMaster, gMaster, bMaster] = imsplit(masterImage);
for k = 1 : numImages]
filename = fullfile(folder, whatever-------------)
thisImage = imread(filename);
% Find pixels that are pure white (255,255,255)
whiteMask = all(thisImage == 255, [], 3);
% Get mask of other pixels that are the
linesMask = ~whiteMask;
[r, g, b] = imsplit(thisImage);
rMaster(linesMask) = r(linesMask);
gMaster(linesMask) = g(linesMask);
bMaster(linesMask) = b(linesMask);
end
masterImage = cat(3, rMaster, gMaster, bMaster);
0 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!