how to combine two different binary image?
29 views (last 30 days)
Show older comments
Indra Ginanjar A.T
on 29 Dec 2015
Answered: Markus Gaasholt
on 28 Apr 2020
Halo im Indra. i have a final project to combine two images from optik disk segmentation and optik cup segmentation on binary image. i cant combine both image. optik disk in white and optik cup in black
. and the result like this picture. can you help me?
Accepted Answer
Image Analyst
on 30 Dec 2015
Use bwperim(). From left to right for your 4 desired images:
image1 = bwperim(opticCup);
image2 = bwperim(opticDisc);
image3 = opticsCup & opticDisc;
image4 = bwperim(image3);
% or
image4 = image1 | image2;
7 Comments
Image Analyst
on 4 Jan 2016
The top portion of your script is missing. Why don't you make it easy for us to help you? subImage is not an RGB image. Don't make me recreate the top part of your script. Just attach the full script m-file with the paper clip icon.
More Answers (1)
Markus Gaasholt
on 28 Apr 2020
I know this is late, but somebody else might need this answer.
First you have to make sure to have the same size of both the images. Then, if the image is binary (only 0 and 1), you can use the 'or' function.
a simple example:
A = [1 0 0 0];
B = [0 0 0 1];
C = or(A, B) = [1 0 0 1]
I = imread ('Image1.tif'); % Getting the first black and white image.
J = imread ('Image2.tif'); % Getting the second black and white image.
I_bw = imbinarize (I ,0.9); % Converts image to black and white image with limit value 0.9 (binary).
J_bw = imbinarize (J ,0.9);
K = or(I, J); % Combines the binary images.
imshow(K, []); % Displays the combined image.
0 Comments
See Also
Categories
Find more on Explore and Edit Images with Image Viewer App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!