码迷,mamicode.com
首页 > 其他好文 > 详细

测量中的一些要点_2

时间:2020-05-29 20:55:18      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:视觉   art   start   dev   bmp   cross   which   rect   inf   

* Measure 02: Code generated by Measure 02
* Measure 02: Prepare measurement
read_image (Image, ‘D:/Project/PC_视觉类/视库/样图/2.bmp‘)
AmplitudeThreshold := 40
RoiWidthLen2 := 50
set_system (‘int_zooming‘, ‘true‘)
* Measure 02: Coordinates for line Measure 02 [0]     //生成一条线
LineRowStart_Measure_02_0 := 1151.61
LineColumnStart_Measure_02_0 := 857.682
LineRowEnd_Measure_02_0 := 1123.16
LineColumnEnd_Measure_02_0 := 1759.5

dev_set_draw (‘margin‘)
dev_get_window (WindowHandle)
disp_line (WindowHandle, LineRowStart_Measure_02_0, LineColumnStart_Measure_02_0, LineRowEnd_Measure_02_0, LineColumnEnd_Measure_02_0)


* Measure 02: Convert coordinates to rectangle2 type   //由上述的线扩展生成一个矩形框
TmpCtrl_Row := 0.5*(LineRowStart_Measure_02_0+LineRowEnd_Measure_02_0)
TmpCtrl_Column := 0.5*(LineColumnStart_Measure_02_0+LineColumnEnd_Measure_02_0)
TmpCtrl_Dr := LineRowStart_Measure_02_0-LineRowEnd_Measure_02_0
TmpCtrl_Dc := LineColumnEnd_Measure_02_0-LineColumnStart_Measure_02_0
TmpCtrl_Phi := atan2(TmpCtrl_Dr, TmpCtrl_Dc)
TmpCtrl_Len1 := 0.5*sqrt(TmpCtrl_Dr*TmpCtrl_Dr + TmpCtrl_Dc*TmpCtrl_Dc)
TmpCtrl_Len2 := RoiWidthLen2
* Measure 02: Create measure for line Measure 02 [0]
* Measure 02: Attention: This assumes all images have the same size!

//以下为生成一个测量框MsrHandle_Measure_02_0
gen_measure_rectangle2 (TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2, 3840, 2748, ‘nearest_neighbor‘, MsrHandle_Measure_02_0) //此为矩形框的参数。   3840, 2748为图片尺寸

gen_rectangle2 (Rectangle, TmpCtrl_Row, TmpCtrl_Column, TmpCtrl_Phi, TmpCtrl_Len1, TmpCtrl_Len2)

* Measure 02: ***************************************************************
* Measure 02: * The code which follows is to be executed once / measurement *
* Measure 02: ***************************************************************
* Measure 02: *************
* Measure 02: * ATTENTION *
* Measure 02: *************
* Measure 02: The image from the graphics window is not available. At this point,
* Measure 02: it is necessary to ensure an image is stored in the variable ‘Image‘
* Measure 02: Execute measurements

* measure_pos(Image : : MeasureHandle, Sigma, Threshold, Transition, Select : RowEdge, ColumnEdge, Amplitude, Distance)
measure_pos (Image, MsrHandle_Measure_02_0, 1, AmplitudeThreshold, ‘all‘, ‘all‘, Row_Measure_02_0, Column_Measure_02_0, Amplitude_Measure_02_0, Distance_Measure_02_0)  //Sigma一般为1,AmplitudeThreshold如上定为40,一般20~40,

 Row_Measure_02_0, Column_Measure_02_0, 测得的2个边的点

Amplitude_Measure_02_0:边缘幅度(带符号)暂无用
gen_cross_contour_xld (Cross, Row_Measure_02_0, Column_Measure_02_0, 16, 0.785398)
* Measure 02: Do something with the results

技术图片

 

测量中的一些要点_2

标签:视觉   art   start   dev   bmp   cross   which   rect   inf   

原文地址:https://www.cnblogs.com/dingyd/p/12989281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!