【问题标题】:Carrying out edge detection on the ROI of image in MatlabMatlab中对图像的ROI进行边缘检测
【发布时间】:2016-01-21 20:28:46
【问题描述】:

如何在不处理图像其余部分的情况下(仅)对图像的 ROI 进行边缘检测?我尝试了以下方法,但它不起作用:

h4 = @(x) edge(x,'log');
Edge_map = roifilt2(Foregound_Newframe,roi_mask,h4);

roi_mask 是我使用的二进制掩码,Foregound_Newframe 是要处理的灰度图像。请提供一个例子。谢谢。

【问题讨论】:

  • 那么你有没有尝试我的建议?

标签: matlab


【解决方案1】:

我看到的错误是您用于执行过滤的函数需要double 类型的输入参数,否则您的调用语法应该可以正常工作。

即使用

YourFilter = @(x) edge(double(x),'log');

当我将其应用于roifilt2 docs 的示例时,它工作正常(好吧,在这种情况下看起来很奇怪......):

clc
clear

FullImage = imread('eight.tif');
roi_col = [222 272 300 270 221 194];
roi_row = [21 21 75 121 121 75];

ROI = roipoly(FullImage,roi_col,roi_row);

YourFilter = @(x) edge(double(x),'log');

J = roifilt2(FullImage,ROI,YourFilter);
figure, imshow(FullImage), figure, imshow(J)

输出如下:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-21
    • 2011-06-29
    • 1970-01-01
    • 2010-12-01
    • 2016-01-08
    • 1970-01-01
    相关资源
    最近更新 更多