How to obtain intrinsic parameter files in JSON format for UHP-140 cameras in Halcon?

Our customer uses our UHP-140 cameras but does not employ our software. Instead, they process images using Halcon. Currently, they require intrinsic parameter files in JSON format for the camera.

However, the sample we currently provide only displays intrinsic parameters and cannot save them in JSON format. Can we provide an additional sample to help the customer achieve this?

Your requirement: save intrinsic parameters obtained from Halcon in JSON format.

  1. For converting intrinsic parameters into a format readable in Halcon, please refer to: Convert Mech-Eye intrinsic parameters for use in Halcon.
  2. To convert intrinsic parameters into the JSON format, refer to the code below:
* Obtain intrinsic parameters
cam_mat_to_cam_par ([1276.4987987901245, 0., 793.3323974609375,0., 1276.4987987901245, 784.4718704223633, 0., 0., 1.], 0, 1280, 1024, CameraParam)
* Create and open intrinsic parameter file
open_file ('CameraParam.json', 'output', FileHandle)
* Write intrinsic parameters
dict_to_json (dict{ DepthMatrix: [CameraParam[1:2],CameraParam[3:4],CameraParam[5:6]]}, [], [], JSONString)
fwrite_string(FileHandle,JSONString)
* Close file
close_file (FileHandle)

After the steps above, you can obtain the JSON file in the folder where the Halcon program is located. The JSON file obtained from the sample above is as follows:
{"DepthMatrix":[1276.4987987901245,0,1,1,793.3323974609375,784.47187042236328]}

You can modify the content according to your specific needs.