필터 지우기
필터 지우기

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.

답변 (1개)

Prahlad Gowtham Katte
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!

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by