0

In Halcon's sample camera_calibration_multi_image.hdev there is following code:

image_points_to_world_plane (CamParam, Pose, Row, Col, 'mm', X1, Y1)
distance_pp (X1[0:11], Y1[0:11], X1[1:12], Y1[1:12], Distance)

Documentation says that x and y contain the X and Y coordinates of the points in the world coordinate system. So if Col and Row can be arrays, X1 and Y1 also have to be arrays.. but in the next line, they are accessed like this:X1[0:11] and I cant figure out what this means.. what 0 and 11 refer to since its simply a list of 12 points in this sample...

sharkyenergy
  • 3,842
  • 10
  • 46
  • 97

1 Answers1

1

It is calculating the distance between points on the ruler. If you look at the final picture you can see there are 13 points. The "line image_points_to_world_plane" converts the pixel coordinates given in the row, col arrays to world coordinates given in X1, Y1. The line "distance_pp" then calculates the distance between these points, ie distance between X0 and X1, X1 and X2, X2 and X3 all the way to X11 and X12. It does the same for the Y points.

enter image description here

One of the most useful things to look at is the variable inspection window. In this case we can look at it and see the full array for X1. The first value is 28.1494 and the second value is 23.1566. The difference between them is 28.1494 - 23.1566 = 4.9928 which is the value inside the first index of "Distance".

enter image description here

Jake Chittle
  • 316
  • 1
  • 2
  • 4
  • 1
    Yes. So X1[0:11] selects the first 12 elements inside the array or tuple. Also I edited the above answer to show you the usefulness of the variable inspection window. You can use that to view the data inside the arrays. – Jake Chittle May 21 '20 at 14:29