0

Matlab Version : 7.8.0(R2009a)

I am using Canny edge detector in Matlab to find the edges, But for my problem, I need some X amount of edges. I need more no. of edges then it is returned by setting threshold as 0. For example in the below image : bw = edge(lena,'canny',0); imshow(bw)

Lena, with Highthresh = 0
I am still getting some black area. I want to get some more edges in those regions. So, what is the minimum value of threshold, canny could take? I am already giving zero.

Note: Interestingly, Matlab is not giving error for negative values of Threshold. But it is still giving same edges. [bw1 t]= edge(j(:,:,2),'canny',-7577908988800); is giving t as -3.0312 -7.5779

Mangat Rai Modi
  • 5,397
  • 8
  • 45
  • 75

1 Answers1

0

The official documentation for edge specifies

thresh is a two-element vector in which the first element is the low threshold, and the second element is the high threshold. If you specify a scalar for thresh, this scalar value is used for the high threshold...

Try explicitly setting the lower threshold, rather than just the high threshold:

[bw1 t]= edge(j(:,:,2),'canny',[-inf SomethingBig])
slayton
  • 20,123
  • 10
  • 60
  • 89
  • Thanks for the reply, but Setting High threshold to large value(MAX is 1 in matlab), will give me very few or no edges. I tried setting both at -inf but I get same no. of edges as 0 :( – Mangat Rai Modi Jan 16 '13 at 18:13
  • @MangatRai, Instead of blinding guessing valid thresholds, work off of the values of `t` that you are getting when you dont specify a threshold. – slayton Jan 16 '13 at 19:01