how to detect only object without background?

2 次查看(过去 30 天)
  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
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
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