• API
• FAQ
• Tools
• Archive
daily pastebin goal
27%
SHARE
TWEET

# Finding grain orientation in the weilding heat-affected zone

a guest May 18th, 2012 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # gmic macro.gmic HAZ.png --haz_orientation 40 -compose_rgba[0,1]
2. # \$1 : sample size
3. # \$2 : orientation accuracy in degrees (must be a factor of 360)
4. haz_orientation: -skip \${1=40},\${2=10}
5.   -e[^-1] "sample size : \$1 and accuracy : \$2.\n"
6.   -v -
7. #  -blur 1
9.   ww=@{-1,round(w/\$1)}
10.   hh=@{-1,round(h/\$1)}
11.   -split_tiles \$ww,\$hh
12.   -repeat @#
13.   -local[-1]
14.     --hough {360/\$2},1
15.     -split[-1] x,2 -+[-2,-1]    #so that 45°==225°
16.     orientation=@{-1,(xM+0.5)/360*(2*pi)*\$2}    #from degree to radian
17. -v +    confidence=@{-1,iM/ia/w/h} -v -
18.     dx={cos(\$orientation+pi/2)*(\$1*\$confidence)}
19.     dy={sin(\$orientation+pi/2)*(\$1*\$confidence)}
20.     -rm[-1]                     #remove hough transform
21.     -resize 100%,100%,1,4       #4 channels
22.     -fill 0                     #image initialisation
23.     -line {\$1/2+\$dx},{\$1/2+\$dy},{\$1/2-\$dx},{\$1/2-\$dy},1,255,0,0,255
24.     -line 0,0,0,100%,1,0,255,0,50
25.     -line 0,0,100%,0,1,0,255,0,50   #green frame
26.     --resize 100%,100%,1,1 -fill[-1] \$orientation
27.     --fill[-1] \$confidence
28.   -endlocal
29.     p={round(100*\$>/@#)}
30. #    -progress \$p -v + -e[] "\r  "\$p% -v -
31.   -mv[-3--1] 0
32.   -done
33.   -append_tiles[0--3:3] \$ww,\$hh
34.   -append_tiles[1--2:2] \$ww,\$hh
35.   -append_tiles[2--1] \$ww,\$hh
36.   -v +
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top