Find Threshold on Canny edge image problem

Dear all experts,
I met a question about how to find the threshold values by giving a fixed edge percentage on canny edge detection problem. I use two 5x5 gradient filters. The code is showns below:
% convolve filterX and filterY with Image to get magnitude gradient and angle
Ix = conv2(Image,filterX); % filterX is a 5x5 gradient filter
Iy = conv2(Image,filterY); % filterY is a 5x5 gradient filter
magnitude = sqrt(Ix.^2+Iy.^2);
angle = atan2(Iy,Ix);
% How to find threshold based on the %percentage? The edge_percentage is the
% proportion of pixels supposed to be treated as potential edge points
max = max(max(magnitude));
min = min(min(magnitude));
% threshold = some percentage work

8 件のコメント

Image Analyst
Image Analyst 2020 年 5 月 9 日
We have no idea what percentage of your objects you expect to be edge points. It depends on the image. Obviously a circle has the lowest proportion of edge points, while an asterisk * shaped blob will have a much higher percentage.
Tony123
Tony123 2020 年 5 月 10 日
the value of the percentage is set as 90% as default
Image Analyst
Image Analyst 2020 年 5 月 10 日
Again, it depends on the image. And you can set a threshold to get any binary image you want, but percentage of What? What is your reference? Attach your image.
Tony123
Tony123 2020 年 5 月 11 日
I attached the target picture
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 5 月 11 日
Sorry I am not getting the question.
Tony123
Tony123 2020 年 5 月 11 日
編集済み: Tony123 2020 年 5 月 11 日
It's to find a threshold such that a fixed percentage of the gradients are considered to be possible edge points. Then I will use the calculated edge orientation, create 4 binary images representing the horizontal, vertical, diagonally up and diagonally down edges exceeding the threshold. I also attached the gradient filters I am going to use
Image Analyst
Image Analyst 2020 年 5 月 11 日
Make it easy for us to help you. Give us code to create filterX and filterY.
Tony123
Tony123 2020 年 5 月 11 日
Sorry for the unclear, I attached my code

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

回答 (0 件)

質問済み:

2020 年 5 月 9 日

コメント済み:

2020 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by