【发布时间】:2016-07-22 16:41:53
【问题描述】:
我目前正在学习计算机视觉,我想从图像中提取洋葱。最好的方法是什么?
我尝试了一种阈值化方法,通过将图像分解为其 R、G、B 通道来检测白色,但它也可以检测图像其他部分的光反射。如何清理此图像以获得近似代表洋葱的蒙版?
onionRGB = imread('onion.png');
onionGRAY = rgb2gray(onionRGB);
figure, imshow(onionRGB);
% split channels
rOnion = onionRGB(:, :, 1); % red channel
gOnion = onionRGB(:, :, 2); % green channel
bOnion = onionRGB(:, :, 3); % blue channel
whiteThresh = 160*3;
% detect white onion
onionDetection = double(rOnion) + double(gOnion) + double(bOnion);
% apply thresholding to segment the foreground
maskOnion = onionDetection > whiteThresh;
figure, imshow(maskOnion);
【问题讨论】:
标签: matlab image-processing feature-detection feature-extraction