【问题标题】:MATLAB - How to eliminate shadowed background on an imageMATLAB - 如何消除图像上的阴影背景
【发布时间】:2015-08-30 20:23:42
【问题描述】:

我正在尝试处理图片。有一张 RGB 叶子照片,我只想提取叶子本身。

我遵循的程序是

  1. 我从文件中读取图像
  2. 转换为灰度
  3. 应用 5x5 中值滤波器
  4. 转换为 BW

如您所见,右下角的阴影粘在 BW 图像上。有没有办法只选择叶子。

I = imread(files{404});

hcsc = vision.ColorSpaceConverter;        
hcsc.Conversion = 'RGB to intensity';       
Ig = step(hcsc, I);

medFilt= vision.MedianFilter([f f]);
Ig = step(medFilt, Ig);

at = vision.Autothresholder;        
Ibw = step(at, Ig);

【问题讨论】:

  • 为什么要转灰度?您也许可以转换为 HSV 并根据色调范围选择叶子。见this anwer
  • @LuisMendo 我从来没想过。我会试试的。

标签: matlab image-processing image-segmentation matlab-cvst


【解决方案1】:

我没有将其转换为灰度图像,而是将其转换为 HSV 并获取其 V 部分。现在效果更好了。

I = imread(files{404});

I = rgb2hsv(I);

Ig = I(:,:,3);

medFilt= vision.MedianFilter([f f]);
Ig = step(medFilt, Ig);

at = vision.Autothresholder;        
Ibw = step(at, Ig);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-25
    • 1970-01-01
    • 2019-07-22
    • 1970-01-01
    • 1970-01-01
    • 2015-06-18
    相关资源
    最近更新 更多