2016-01-21 189 views
0

怎麼辦上的圖像的ROI(只)邊緣檢測而不處理圖像的其餘部分?我曾嘗試以下,但它不工作:實施邊緣檢測圖像的ROI在Matlab

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

roi_mask的是,我使用的二進制掩碼和Foregound_Newframe是要處理的灰度圖像。請舉一個例子。謝謝。

+0

你是否試過我的建議? –

回答

1

我看到的錯誤是,你正在使用做過濾的功能,需要double類型的輸入參數,否則您的通話語法應該很好地工作。

即使用

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

當我將此從roifilt2docs它工作得很好的例子(好吧,它看起來怪異在這種情況下...):

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) 

與下面的輸出:

enter image description here