Commit c47d820ac507a94127e23660e220e3ae09c509ba
- Diff rendering mode:
- inline
- side by side
l03-fourier2d.hs
(2 / 0)
  | |||
18 | 18 | -- 24pix image of r1=3 and r2=9 white torus on black background | |
19 | 19 | torus = torusGrayImage 24 3 9 1 0 | |
20 | 20 | storus = gaussian (3,3) torus | |
21 | -- 20pix image of r=5 white square on black background | ||
21 | 22 | square = squareGrayImage 20 5 1 0 | |
22 | 23 | ssquare = gaussian (3,3) square | |
24 | -- 20pix image of r=5 white diamond on black background | ||
23 | 25 | diamond = diamondGrayImage 20 5 1 0 | |
24 | 26 | sdiamond = gaussian (3,3) diamond | |
25 | 27 |
l03-gabor.hs
(10 / 5)
  | |||
4 | 4 | import CV.Filters | |
5 | 5 | import CV.ImageMath as IM hiding (div) | |
6 | 6 | import CV.ColourUtils | |
7 | import CV.Operations | ||
7 | 8 | ||
8 | 9 | import Filters | |
10 | import Fourier | ||
9 | 11 | import Gabor | |
10 | 12 | ||
11 | 13 | size = 7 | |
… | … | ||
19 | 19 | main = do | |
20 | 20 | img <- readFromFile "park.png" | |
21 | 21 | let | |
22 | (gimg1,gimg2) = filterGabor mask size center img | ||
22 | (gre,gim) = filterGabor mask size center img | ||
23 | (gamp,gpha) = dftToPolar2D (gre, gim) | ||
23 | 24 | saveImage "gabor.png" $ montage (2,2) 2 $ | |
24 | [ stretchHistogram gimg1 | ||
25 | , stretchHistogram gimg2 | ||
26 | , stretchHistogram $ IM.sqrt $ (IM.add (IM.mul gimg1 gimg1) (IM.mul gimg2 gimg2)) | ||
27 | , stretchHistogram $ IM.atan2 gimg2 gimg1 | ||
25 | [ logNormalize gre | ||
26 | , logNormalize gim | ||
27 | , stretchHistogram gamp | ||
28 | --IM.sqrt $ (IM.add (IM.mul gimg1 gimg1) (IM.mul gimg2 gimg2)) | ||
29 | , unitNormalize gpha | ||
30 | -- $ IM.atan2 gimg2 gimg1 | ||
28 | 31 | ] |