- Multiply two images or multiply image by constant - MATLAB immultiply (mathworks.com)
- Binarize 2-D grayscale image or 3-D volume by thresholding - MATLAB imbinarize (mathworks.com)
How to choose a ROI in an image and mask the other data in a colored image?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have images in differet time steps (sample is attached) , I transfered them into M by N by T matrix. Now, I would like to Only have ROI (yellowish color whith all the information in this region) for all sequences. Then I need to have pixel data of a constant distance from border line i.e. to have data of radious in x direction.
댓글 수: 0
답변 (1개)
Prahlad Gowtham Katte
2022년 3월 15일
Hello
As per my understanding of your query you wish to mask the region other than the yellow-colored part of the image. You can convert the color image to binary and the white pixels represent the yellow-colored part acting as a mask. When you multiply the binary image with colored one. You get only the yellow-colored part and rest will be black. The following code will help to visualize the above.
clear all;
img=imread('SamplePicIR.png');
i=rgb2gray(img); %rgb to gray conversion
imshow(i);
bin=imbinarize(i);%gray to binary conversion
imshow(bin);
bin2(:,:,1)=bin;
bin2(:,:,2)=bin;
bin2(:,:,3)=bin;
z=immultiply(img,bin2);%Applying bin2 as a mask
imshow(z);
For more information, please refer to the following links:
Hope it helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!