Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

News

Halcon Learning Notes-Camera Calibration

1. read_cam_par(:: CamParFile: CameraParam)

Read the camera's internal parameters from the folder.

2. disp_caltab (:: Windows Handle, CalTab DescrFile, Camera Param, CaltabPose, ScaleFac:)

The calibration board model is projected to the image plane by using the camera's internal and external parameters. The calibration points and connection lines are displayed. X and Y axes are also displayed.

3. vector_to_pose (:: WorldX, WorldY, WorldZ, ImageRow, ImageColumn, CameraParam, Method, QualityType: Pose, Quality)

The absolute pose parameters of the relationship between world coordinates and image coordinates are calculated. The world coordinates should choose at least three points that are not on the same line.

If the point on the world coordinate is on a plane, it should choose'planar_analytic'as the parameter of Method. Output pose and pose quality.

4. write_pose(:: Pose, PoseFile:)

Write posture to TXT file.

5. get_mbutton (:: Windows Handle: Row, Column, Button)

Return the pixel coordinates of the image points clicked by the mouse, as well as the mouse button values, left key 0, middle key 2, right key 4.

6. image_points_to_world_plane (:: Camera Param, WorldPose, Rows, Cols, Scale: X, Y)

The image coordinates are transformed into the world coordinates of Z = 0 plane, and the output is X, Y of the world coordinates.

7. pose_to_hom_mat3d (:: Pose: HomMat3D)

The 3D pose is transformed into homogeneous transformation matrix.

8. affine_trans_point_3d (:: HomMat3D, Px, Py, Pz: Qx, Qy, Qz)

The affine transformation of 3D coordinates between two coordinate systems is carried out.

/ QxPx\

| Qy | = HomMat3D * | Py|

| Qz | | Pz|

\ 1/1/

9. Project_3d_point (:: X, Y, Z, CameraParam: Row, Column)

The 3D point is mapped to the image coordinate system and the row coordinates of the point in the image coordinate system are returned.



10. smallest_rectangle2 (Regions:: Row, Column, Phi, Length1, Length2)

Returns the smallest surround rectangle containing a region.

11. gen_measure_rectangle2 (:: Row, Column, Phi, Length1, Length2, Width, Height, Interpolation: MeasureHandle)

Returns the edge perpendicular to the rectangular edge.

12. measure_pairs (Image:: MeasureHandle, Sigma, Threshold, Transition, Select: Row Edge First, Column Edge First, AmplitudeFirst, Row Edge Second, Column Edge Second, AmplitudeSecond, Intra Distance, Interance)

Extract edge pairs perpendicular to rectangular edges. Returns the distance between each pair of measurements.

13. close_measure (:: MeasureHandle:)

Delete the measurement handle.

14. gen_region_polygon_filled (: Region: Rows, Columns:)

Create a polygon filling area and output it as a region.

15. gen_region_polygon_filled (: Region: Rows, Columns:)

The line width is extracted and the output is an array in XLD form.

16. hom_mat3d_compose (:: HomMat3D Left, HomMat3D Right: HomMat3D Compose)

Output product of two homogeneous matrices.

17. hom_mat3d_translate_local (:: HomMat3D, Tx, Ty, Tz: HomMat3D Translate)

Compared with the new coordinate system, a translation is added to the homogeneous matrix HomMat3D, and the output is a new homogeneous matrix.

18. hom_mat3d_rotate_local (:: HomMat3D, Phi, Axis: HomMat3D Rotate)

Compared with the new coordinate system, a screw around a coordinate axis is added to the homogeneous matrix HomMat3D, and the output is a new homogeneous matrix.

17. Contour_to_world_plane_xld (Contours: ContoursTrans: Camera Param, WorldPose, Scale:)

Convert the XLD contour into the world coordinate plane of Z=0, and the output form is xld_cont(-array)object.

18. get_contour_xld (Contour::: Row, Col)

Returns the row and column coordinates of the contour point.

19. tuple_mean(:: Tuple: Mean)

Returns the average of the array

20. map_image (Image, Map: Image Mapped::)

The image is corrected and the output is the corrected image.



Appendix: Procedures for camera calibration and image calibration using the calibrated results:



1: * Attention:

2: * This program reads the interior camera parameters from the file

3: *'camera_parameters.dat', which, e.g., could be generated by the program

4: *'camera_calibration_interior.hdev'

5: *

6: ImgPath: ='3d_machine_vision/calib/'

7: dev_close_window()

8: dev_open_window (0, 0, 652, 494,'black', Windows Handle)

9: dev_update_off()

10: dev_set_draw ('margin')

11: dev_set_line_width (1)

12: set_display_font (Windows Handle, 14,'courier','true','false')

13: * Read the interior camera parameters from file

14: read_cam_par ('camera_parameters.dat', CamParam)

15: *

16: * Determine the exterior camera parameters and world coodinates from image points

17: *

18: * The exterior camera parameters can be determined from an image, where the

19: * calibration plate is positioned directly on the measurement plane

20: read_image (Image, ImgPath+'calib_11')

21: dev_display (Image)

22: * parameter settings for find_caltab and find_marks_and_pose

23: Size Gauss: = 3

24: Mark Thresh: = 200

25: MinDiamMarks: = 10

26: Start Thresh: = 128

27: DeltaThresh: = 10

28: MinThresh: = 18

29: Alpha: = 0.9

30: MinContLength: = 15

31: MaxDiamMarks: = 100

32: CaltabName: ='caltab_30mm. descr'

33: find_caltab (Image, Caltab, CaltabName, Size Gauss, Mark Thresh, MinDiamMarks)

34: dev_set_color ('green')

35: dev_display (Caltab)

36: * Here, the final camera parameters are already known and can be used instead of the starting values

37: * used in the program'camera_calibration_interior.hdev'

38: find


Please read the Chinese version for details.

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code