测量中的一些要点_2

Posted dingyd

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了测量中的一些要点_2相关的知识,希望对你有一定的参考价值。

* 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的主要内容,如果未能解决你的问题,请参考以下文章

测量中的一些要点

测量中的一些要点

react学习关于react框架使用的一些细节要点的思考

JS中的constructorprototype__proto__的要点理解

gulp自动添加版本号过程中的一些要点记录

经验分享谈谈工业质检中的二维测量算子