# how to plot an image and a logical matrix on same plot

조회 수: 31(최근 30일)
Idan Golcmn 3 Apr 2020
댓글: darova 4 Apr 2020
Hi,
I have an image in a matrix (uint 16) and a matrix that contain the border of a mask that i have done to the image. i want to plot the image and the mask together, so i can plot them together and see them both.
the two images are in the attached file.
when im plotting them together, i only see one of the pictures (using hold on). The problem is that the logical matrix is max 1 and the image matrix getting different values grater than 1 so i dont see it. I want it ti be like a line in different color on the image that represent real data.
edit: i added another image (this time Matlab image) that contains 4 images. I want print every two images (from the same row) together in a way that will be able to see the avarage frame and the mask bounderi that was created by my function.

#### 댓글 수: 2

Ameer Hamza 3 Apr 2020
I guess you don't need to plot the mask as an image. You can use plot() function to draw the boundary. Can you attach the image and the mask in a mat file so that it will be easy to suggest a solution?
Idan Golcmn 4 Apr 2020
Hi ameer.
you right i can print in any format it dotesnt metter. i hava upload the images in the question (the attatched file).
i'm not really sure what images do you need and at which format. i can upload everything to solve the problem.
edit: i have add another image, hope you will find it useful.
thanks.

로그인 to comment.

### 답변(1개)

darova 3 Apr 2020
Try this
ind = mask > 0.8;
img(ind) = max(img(:));
imshow(img)

#### 댓글 수: 2

Idan Golcmn 4 Apr 2020
Hi darova.
the error is: "Undefined function 'imgshow' for input arguments of type 'uint16'"
My mask matrix is a matrix of zeros and ones. im taking just the border of the mask that i have calculated, and (logiacal matrix).
i have a good image that i'm printing, now i just need to add the bounderis of the mask in a way that one can see the bounderies and the image that represents the avarage of the data (frames) that i have.
edit: i add another image, hope you will find it useful.
thanks.
darova 4 Apr 2020
mask1 = im2bw(mask0,thr); % convert to logical
mask1 = repmat(mask1,[1 1 3]); % create 3D matrix
I1 = I0;
I1(mask1) = 255; % fill border pixels with 255 (white)
imshow(I1)

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

R2019b

Translated by