how to detect only object without background?

조회 수: 2 (최근 30일)
wongsathorn pinwihok
wongsathorn pinwihok 2020년 2월 2일
댓글: wongsathorn pinwihok 2020년 2월 2일
  댓글 수: 2
Guillaume
Guillaume 2020년 2월 2일
You'll get more chance of getting help if you actually write words to explain what you want.
As it is,we just have a question title with no definition of what's an object (the foot? the white dots?) or what's background (the black bit).
wongsathorn pinwihok
wongsathorn pinwihok 2020년 2월 2일
the object is the foot and the background is the black bits.

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

채택된 답변

Image Analyst
Image Analyst 2020년 2월 2일
Find out where all color channels are darker than some threshold, then and the masks and take the largest blob
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Threshold to create mask for each channel.
threshold = 20; % Whatever...
mask = (redChannel < threshold) & (greenChannel < threshold) & (blueChannel < threshold);
backgroundMask = bwareafilt(mask, 1); % Take largest blob
footMask = ~backgroundMask; % The inverse of the background mask.
  댓글 수: 1
wongsathorn pinwihok
wongsathorn pinwihok 2020년 2월 2일
I = imread('test.jpg');
rotI = imrotate(I,0,'crop');
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Threshold to create mask for each channel.
threshold = 20; % Whatever...
mask = (redChannel < threshold) & (greenChannel < threshold) & (blueChannel < threshold);
backgroundMask = bwareafilt(mask, 1); % Take largest blob
footMask = ~backgroundMask; % The inverse of the background mask.
imshow(rotI);
Am I right?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by