how do i segment the attached image based on color?

조회 수: 2 (최근 30일)
Md. Motiur Rahman
Md. Motiur Rahman 2018년 5월 18일
댓글: Md. Motiur Rahman 2018년 5월 21일
i need to select the only fruit region and extract various color feature. That is why i need to segment the image and select only fruit region. Please give me your suggestion in this regard.
  댓글 수: 1
Md. Motiur Rahman
Md. Motiur Rahman 2018년 5월 19일
편집: Md. Motiur Rahman 2018년 5월 20일
I have done the segmentation and able to select the fruit region. i also get the Pixel Id list of the selected fruit region here thisBlobsPixels = blobMeasurements(k).PixelIdxList; Now how can i use this pixel id list to compute various color channel (red channel, green channel, blue channel) of the selected region. The attached image is gray scale image. Thanks in advance.

댓글을 달려면 로그인하십시오.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 5월 20일
편집: KALYAN ACHARJYA 2018년 5월 20일
    % code
input_image=imread('banana.png');
pattern=repmat(all(~input_image,3),[1 1 3]); 
%convert to white pixels
input_image(pattern)=255; 
imshow(input_image);
  댓글 수: 2
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 5월 20일
By doing loop, you can find the R,G,B of any pixels.
input_image(i,j,1) % gives R value of respective pixel;
input_image(i,j,2) % gives G value of respective pixel;
input_image(i,j,3) % gives B value of respective pixel;
Md. Motiur Rahman
Md. Motiur Rahman 2018년 5월 21일
i only have pixel id list not x, y coordinates of pixel.
thisBlobsPixels = blobMeasurements(k).PixelIdxList;
it returns all pixel id list in one dimensional array.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by