can any one help me to implement this matlab code

Hi,
I need your help please to implement a matlab code for Edge drawing Edge Drawing works on grayscale images and is comprised of 4 steps:
(1) Suppression of noise by Gaussian filtering,
(2) Computation of the gradient magnitude and edge direction maps,
(3) Extraction of the anchors (peaks of the gradient map),
(4) Linking of the anchors by smart routing to compute the final edge map.
This is a link that can explain the method.
thanks

댓글 수: 7

show the code you have arrived at so far, and describe the error messages you received when you tried your code.
The link has a download link. Have you tried to download the code, and translate into MATLAB if necessary? Who do you think should do that?
The download link leads to binaries.
The algorithms in Table 1 and Table 2 would be easily translated to MATLAB.
Hi, the code in the download link is programmed in C++. I have no idea about this language. I tried to do it with matlab
I=imread('image.jpg');
figure;imshow(I);
I2=rgb2gray(I);
figure;imshow(I2);
H = fspecial('gaussian');
I3 = imfilter(I2,H,'replicate');
figure;imshow(I3);
imgrad = gradient(I3)
figure;imshow(imgrad);
But I have this error
??? Error using ==> rdivide Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> gradient at 75
g(2:n-1,:) = (f(3:n,:)-f(1:n-2,:))./h(:,ones(p,1));
Error in ==> edgedrawing at 8
imgrad = gradient(I3)
Also i couldn't implement the matlab code of edge direction maps, extraction of the anchors and linking of the anchors by smart routing to compute the final edge map.
Try casting I3 to single before passing it in.
thanks for your reply
I=imread('image.png');
figure;imshow(I);
I2=rgb2gray(I);
figure;imshow(I2);
H = fspecial('gaussian');
I3 = imfilter(I2,H,'replicate');
figure;imshow(I3);
I3 = single(I3)
imgrad = gradient(I3);
figure;imshow(imgrad);
But i have this result
with this image
Hi @Pamela Paolo , could you please share with me the C++ code of this paper? Thanks a lot.

댓글을 달려면 로그인하십시오.

답변 (2개)

Pamela Paolo
Pamela Paolo 2012년 10월 25일

0 개 추천

What is the purpose of casting I3 to single?? becuse i haven't a good result of gradient

댓글 수: 2

I haven't run your code but when it says " Integers can only be combined with integers of the same class, or scalar doubles." it means that it's trying to do something with your integer array, like combine it somehow with a single or double array, and that is against MATLAB's rules. There is no such rule with singles and doubles combining with each other so that's why I said to cast it to single.
Pamela Paolo
Pamela Paolo 2012년 10월 26일
편집: Pamela Paolo 2012년 10월 26일
Thanks for your reply
Have you an idea about the programming of these steps with matlab:
-edge direction maps
-extraction of the anchors
-linking of the anchors by smart routing to compute the final edge map.

댓글을 달려면 로그인하십시오.

Pamela Paolo
Pamela Paolo 2012년 10월 29일
Hi
To find the gradient can i use
serl=[1 1 1,1 1 1, 1 1 1 ];
image1=imdilate(I3,serl);
image2=imerode(I3,serl);
grad=image1-image2;
what are the matlab functions used to program these steps:
-edge direction maps
-extraction of the anchors
-linking of the anchors by smart routing to compute the final edge map.

댓글 수: 3

I don't think that would give the gradient as one would normally think about it. There is a gradient() function you know. You could also use conv2(yourImage, [-1 -1 -1; -1 8 -1; -1 -1 -1]); For the rest, it sounds like you have a particular paper in mind, and I imagine that should give the details for each of those steps.
Hello
I have only this link http://ceng.anadolu.edu.tr/CV/EdgeDrawing/. I haven't more details. That is why I asked the question. thanks
I=imread('image.png');
figure;imshow(I);
I2=rgb2gray(I);
figure;imshow(I2);
H = fspecial('gaussian');
I3 = imfilter(I2,H,'replicate');
figure;imshow(I3);
I3 = single(I3)
imgrad = gradient(I3);
figure;imshow(imgrad);
Hello,
I need your help to understand these steps
-Computation of the gradient magnitude and edge direction maps,
-Extraction of the anchors (peaks of the gradient map),
-Linking of the anchors by smart routing to compute the final edge map.
It's correct to do this to compute the gradient magnitude and edge direction maps?
[Gmag,Gdir] = imgradient(I3)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

2012년 10월 24일

편집:

2017년 12월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by