dev_update_off ()
dev_close_window ()
dev_open_window (0, 0, 800, 600, 'white', WindowHandle)
dev_set_draw ('margin')
read_image( Image,'fabrik')
*ROI
dev_display(Image)
draw_rectangle1(WindowHandle,row, col, Length1, length2)
rectangle1_domain(Image, ImageReduced, row, col, Length1, length2)
sobel_dir(ImageReduced,EdgeAmplitude,EdgeDirection,'sum_abs', 3)
dev_set_color('red')
threshold(EdgeAmplitude, Region, 55,255)
reduce_domain(EdgeDirection,Region,EdgeDirectionReduced)
hough_lines_dir( EdgeDirectionReduced,HoughImage, Lines, 4, 2, 'mean', 3, 25, 5, 5, 'true', Angle, Dist)
gen_region_hline(LinesHNF, Angle,Dist)
dev_display(LinesHNF)
* Detect lines in an image with the help of the Hough transform
* using the edge direction as additional information and return it both
* in HNF and as regions
*
read_image (Image, 'fabrik')
rectangle1_domain (Image, ImageReduced, 170, 280, 310, 360)
* Detect edges (amplitude and direction) using the Sobel operator
sobel_dir (ImageReduced, EdgeAmplitude, EdgeDirection, 'sum_abs', 3)
dev_set_color ('red')
threshold (EdgeAmplitude, Region, 55, 255)
* Reduce the direction image to the edge region
reduce_domain (EdgeDirection, Region, EdgeDirectionReduced)
* Start the Hough transform using the edge direction information
hough_lines_dir (EdgeDirectionReduced, HoughImage, Lines, 4, 2, 'mean', 3, 25, 5, 5, 'true', Angle, Dist)
* Store input lines described in HNF
gen_region_hline (LinesHNF, Angle, Dist)
dev_display (Image)
dev_set_colored (12)
* Display the lines
dev_set_draw ('margin')
dev_display (LinesHNF)
* Display the edge pixels that contributed to the corresponding lines
dev_set_draw ('fill')
dev_display (Lines)
read_image (Image, 'fabrik')
rectangle1_domain (Image, ImageReduced, 230, 180, 330, 280)
* Detect edges (amplitude) using the Sobel operator
sobel_amp (ImageReduced, EdgeAmplitude, 'thin_sum_abs', 3)
dev_set_color ('red')
threshold (EdgeAmplitude, Region, 10, 255)
hough_lines (Region, 4, 50, 5, 5, Angle, Dist)
dev_set_color ('blue')
* Store input lines described in HNF
gen_region_hline (Regions, Angle, Dist)
dev_update_off ()
dev_close_window ()
dev_open_window (0, 0, 600, 400, 'white', WindowHandle)
dev_set_draw ('margin')
read_image (Image, '01.bmp')
dev_display(Image)
draw_rectangle1(WindowHandle, Row1, Column1, Row2, Column2)
rectangle1_domain (Image, ImageReduced, Row1, Column1, Row2, Column2)
reduce_domain(Image,ImageReduced , ImageReduced1)
*从Image图像中裁剪一个矩形区域
crop_domain(ImageReduced1, ImageROI)
write_image (ImageROI, 'bmp', 0, '0')
dev_display(ImageROI)
smooth_image (ImageROI, ImageSmooth, 'gauss', 0.8)
dev_display(ImageSmooth)
draw_rectangle1(WindowHandle, Row21, Column21, Row22, Column22)
rectangle1_domain (ImageSmooth, ImageRe2, Row21, Column21, Row22, Column22)
reduce_domain(ImageSmooth,ImageRe2 , ImageReRe2)
*从Image图像中裁剪一个矩形区域
*crop_domain(ImageReRe2, ImageROI2)
dev_display(ImageReRe2)
sobel_dir(ImageReRe2, EdgeAmplitude, EdgeDirection, 'sum_abs', 3)
dev_set_color('red')
threshold(EdgeAmplitude, Region, 100,255)
reduce_domain(EdgeDirection,Region,EdgeDirectionReduced)
hough_lines_dir( EdgeDirectionReduced, HoughImage, Lines, 4, 2, 'mean', 3, 25, 5, 5, 'true', Angle, Dist)
gen_region_hline(LinesHNF, Angle,Dist)
dev_display(LinesHNF)