fmw42 wrote:Parshiala wrote:You're misunderstanding the question. My is how to generate a 5x5 edge detection kernel from the edge detection?
Now I really do not understand what you want! Please clarify.
The circle kernel as an image can be created as an image by using -draw "circle ..." and saving as txt: output format. That gives you the values you will need. If the kernel is 5x5, then your constant color (white) circle will have a radius of 2 (2x2+1=diameter). But it won't look much like a circle due to the values being rasters.
You can also create it from a formula, using -fx. See
http://www.imagemagick.org/script/fx.php
the value a=1 should be used. theta=atan2(j/i)
Code: Select all
convert -size 5x5 xc: -fx "x=i-2; y=j-2; theta=atan2(y,x); r=(x*cos(theta)+y*sin(theta); r<2?1:0" txt:
Note IM indices i,j start at zero. So the center pixels is at 2,2.
But all I get for this is solid 100%
Code: Select all
# ImageMagick pixel enumeration: 5,5,65535,srgb
0,0: (100%,100%,100%) #FFFFFFFFFFFF white
1,0: (100%,100%,100%) #FFFFFFFFFFFF white
2,0: (100%,100%,100%) #FFFFFFFFFFFF white
3,0: (100%,100%,100%) #FFFFFFFFFFFF white
4,0: (100%,100%,100%) #FFFFFFFFFFFF white
0,1: (100%,100%,100%) #FFFFFFFFFFFF white
1,1: (100%,100%,100%) #FFFFFFFFFFFF white
2,1: (100%,100%,100%) #FFFFFFFFFFFF white
3,1: (100%,100%,100%) #FFFFFFFFFFFF white
4,1: (100%,100%,100%) #FFFFFFFFFFFF white
0,2: (100%,100%,100%) #FFFFFFFFFFFF white
1,2: (100%,100%,100%) #FFFFFFFFFFFF white
2,2: (100%,100%,100%) #FFFFFFFFFFFF white
3,2: (100%,100%,100%) #FFFFFFFFFFFF white
4,2: (100%,100%,100%) #FFFFFFFFFFFF white
0,3: (100%,100%,100%) #FFFFFFFFFFFF white
1,3: (100%,100%,100%) #FFFFFFFFFFFF white
2,3: (100%,100%,100%) #FFFFFFFFFFFF white
3,3: (100%,100%,100%) #FFFFFFFFFFFF white
4,3: (100%,100%,100%) #FFFFFFFFFFFF white
0,4: (100%,100%,100%) #FFFFFFFFFFFF white
1,4: (100%,100%,100%) #FFFFFFFFFFFF white
2,4: (100%,100%,100%) #FFFFFFFFFFFF white
3,4: (100%,100%,100%) #FFFFFFFFFFFF white
4,4: (100%,100%,100%) #FFFFFFFFFFFF white
Your 5x5 gradient is perhaps too small to represent a circle reasonably or I have made a mistake.
Perhaps someone else can see what I am doing wrong.