(libload "opencv/opencv")

(let*  ((rgbimg  (cvimage-read-rgb "pic1.jpg"))
	(width   (==> rgbimg  get_width))
	(height  (==> rgbimg  get_height))
	(depth   (==> rgbimg  get_depth))
	(grayimg (new cvimage width height depth 1))
	(edgeimg (new cvimage width height depth 1))
	(half-rgbimg (new cvimage 
			  (/ width 2) (/ height 2) 
			  depth 3))
	(roirect (new cvrect 0 0 width height)))

     (cvPyrDown  :rgbimg:p      :half-rgbimg:p   7)
     (cvPyrUp    :half-rgbimg:p :rgbimg:p        7)

     (cvSetImageROI  :rgbimg:p  :roirect:p)
     (cvSetImageCOI  :rgbimg:p  1)
     (cvCopy         :rgbimg:p  :grayimg:p (gptr ()))

     (cvCanny     :grayimg:p    :edgeimg:p   0 50 5)
     (cvDilate    :edgeimg:p    :edgeimg:p   (gptr ()) 1)

     (cvimage-show  edgeimg)  )
