write_cam_parT_write_cam_parWriteCamParWriteCamPar (Operator)

Name

write_cam_parT_write_cam_parWriteCamParWriteCamPar — Write internal camera parameters into a file.

Signature

write_cam_par( : : CameraParam, CamParFile : )

Herror T_write_cam_par(const Htuple CameraParam, const Htuple CamParFile)

void WriteCamPar(const HTuple& CameraParam, const HTuple& CamParFile)

void HCamPar::WriteCamPar(const HString& CamParFile) const

void HCamPar::WriteCamPar(const char* CamParFile) const

void HCamPar::WriteCamPar(const wchar_t* CamParFile) const   (Windows only)

static void HOperatorSet.WriteCamPar(HTuple cameraParam, HTuple camParFile)

void HCamPar.WriteCamPar(string camParFile)

Description

write_cam_parwrite_cam_parWriteCamParWriteCamParWriteCamPar stores the internal camera parameters CameraParamCameraParamCameraParamCameraParamcameraParam into a file specified by its file name CamParFileCamParFileCamParFileCamParFilecamParFile.

The number of values in CameraParamCameraParamCameraParamCameraParamcameraParam depends on the specified camera type. See the description of set_calib_data_cam_paramset_calib_data_cam_paramSetCalibDataCamParamSetCalibDataCamParamSetCalibDataCamParam for a list of values and the chapter Calibration for details on camera types and camera parameters.

The default HALCON file extension for the camera parameters is 'dat'.

The internal camera parameters can be later read with read_cam_parread_cam_parReadCamParReadCamParReadCamPar.

Execution Information

Parameters

CameraParamCameraParamCameraParamCameraParamcameraParam (input_control)  campar HCamPar, HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Internal camera parameters.

CamParFileCamParFileCamParFileCamParFilecamParFile (input_control)  filename.write HTupleHTupleHtuple (string) (string) (HString) (char*)

File name of internal camera parameters.

Default value: 'campar.dat' "campar.dat" "campar.dat" "campar.dat" "campar.dat"

List of values: 'campar.dat'"campar.dat""campar.dat""campar.dat""campar.dat", 'campar.final'"campar.final""campar.final""campar.final""campar.final", 'campar.initial'"campar.initial""campar.initial""campar.initial""campar.initial"

File extension: .dat

Example (HDevelop)

* 
* Calibrate the camera.
* 
StartCamPar := ['area_scan_division', 0.016, 0, 0.0000074, 0.0000074, \
                326, 247, 652, 494]
create_calib_data ('calibration_object', 1, 1, CalibDataID)
set_calib_data_cam_param (CalibDataID, 0, [], StartCamPar)
set_calib_data_calib_object (CalibDataID, 0, 'caltab_30mm.descr')
NumImages := 10
for I := 1 to NumImages by 1
  read_image (Image, '3d_machine_vision/calib/calib_' + I$'02d')
  find_calib_object (Image, CalibDataID, 0, 0, I, [], [])
  get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I)
endfor
calibrate_cameras (CalibDataID, Error)
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
* Write the internal camera parameters to a file.
write_cam_par (CamParam, 'camera_parameters.dat')

Result

write_cam_parwrite_cam_parWriteCamParWriteCamParWriteCamPar returns 2 (H_MSG_TRUE) if all parameter values are correct and the file has been written successfully. If necessary an exception is raised.

Possible Predecessors

camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration

See also

find_caltabfind_caltabFindCaltabFindCaltabFindCaltab, find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration, disp_caltabdisp_caltabDispCaltabDispCaltabDispCaltab, sim_caltabsim_caltabSimCaltabSimCaltabSimCaltab, read_cam_parread_cam_parReadCamParReadCamParReadCamPar, write_posewrite_poseWritePoseWritePoseWritePose, read_poseread_poseReadPoseReadPoseReadPose, project_3d_pointproject_3d_pointProject3dPointProject3dPointProject3dPoint, get_line_of_sightget_line_of_sightGetLineOfSightGetLineOfSightGetLineOfSight

Module

Foundation