フィルターのクリア

Getting Error for Marker and Mask ,Please give solution

2 ビュー (過去 30 日間)
Poonam
Poonam 2013 年 3 月 13 日
編集済み: Günsu 2015 年 1 月 13 日
function[g]=hueedge(f)
hsv=rgb2hsv(f);
I=hsv(:,:,3);
i=medfilt2(I);
sh=fspecial('sobel');
sv=sh;
Gx=conv2(double(i(:,:,1)),sh);
Gy=conv2(double(i(:,:,1)),sv);
Gxy=sqrt(Gx.^2+Gy.^2);
w=[1,1,1;1,-8,1;1,1,1];
Gxy2=conv2(double(i),w);
gr=Gxy-Gxy2;
s=histeq(gr);
%p=imshow(s);
markerImage =false(size(w));
marker(3,3)= true;
q=imreconstruct(markerImage,w);
w=ones(1);
g=imsubtract(s,w);
Error using ==> imreconstructmex
Function imreconstruct expected MARKER and MASK to have the same class.
Error in ==> imreconstruct at 71
im = imreconstructmex(marker,mask);
Error in ==> hueedge at 17
q=imreconstruct(markerImage,w);
  2 件のコメント
Poonam
Poonam 2013 年 3 月 14 日
Now getting error
??? Error using ==> imreconstructmex
MARKER pixels must be <= MASK pixels.
Error in ==> imreconstruct at 71
im = imreconstructmex(marker,mask);
Jan
Jan 2013 年 3 月 18 日
Please ask one question per thread and mark an answer as "accepted", when one problem is solved. Thanks.

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2013 年 3 月 13 日
編集済み: Jan 2013 年 3 月 13 日
The error message is clear, isn't it?
So either convert markerImage to the class of w, or the other way around:
markerImage = double(markerImage);
You define the variable markerImage and modify values in the undefined variable marker. Is this a typo?

Günsu
Günsu 2015 年 1 月 13 日
編集済み: Günsu 2015 年 1 月 13 日
img = imread('img.png');
img=rgb2gray(img);
img= im2uint8(img);
imshow(img);
marker = false(size(img));
marker(33:38,17:55) = true;
marker = im2uint8(marker);
figure,imshow(marker);
im = imreconstruct(marker,img);
figure, imshow(im);
These errors are resolved by using im2uint8
Error using ==> imreconstructmex Function imreconstruct expected MARKER and MASK to have the same class.
Error using ==> imreconstructmex MARKER pixels must be <= MASK pixels.

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by