KlassenKlassenKlassenKlassen | | | | Operatoren

read_cam_parT_read_cam_parReadCamParread_cam_parReadCamParReadCamPar (Operator)

Name

read_cam_parT_read_cam_parReadCamParread_cam_parReadCamParReadCamPar — Lesen der internen Kameraparameter aus einer Textdatei.

Signatur

read_cam_par( : : CamParFile : CameraParam)

Herror T_read_cam_par(const Htuple CamParFile, Htuple* CameraParam)

Herror read_cam_par(const HTuple& CamParFile, HTuple* CameraParam)

void ReadCamPar(const HTuple& CamParFile, HTuple* CameraParam)

static HTuple HMisc::ReadCamPar(const HString& CamParFile)

static HTuple HMisc::ReadCamPar(const char* CamParFile)

void HOperatorSetX.ReadCamPar(
[in] VARIANT CamParFile, [out] VARIANT* CameraParam)

VARIANT HMiscX.ReadCamPar([in] BSTR CamParFile)

static void HOperatorSet.ReadCamPar(HTuple camParFile, out HTuple cameraParam)

static HTuple HMisc.ReadCamPar(string camParFile)

Beschreibung

read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar dient zum Einlesen der internen Kameraparameter CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam aus einer Textdatei mit dem Namen CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile. Die Dateiendung für die Kameraparameter ist in HALCON 'dat'.

Die Anzahl der Werte in CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam richtet sich nach dem Kameratyp. Siehe die Beschreibung von set_calib_data_cam_paramset_calib_data_cam_paramSetCalibDataCamParamset_calib_data_cam_paramSetCalibDataCamParamSetCalibDataCamParam für eine Liste der Werte und calibrate_camerascalibrate_camerasCalibrateCamerascalibrate_camerasCalibrateCamerasCalibrateCameras für detaillierte Informationen über Kameratypen und Kameraparameter.

Die internen Kameraparameter beschreiben den Abbildungsvorgang der verwendeten Kombination von Kamera, Objektiv und Framegrabber und werden durch die Kamerakalibrierung bestimmt, welche mit calibrate_camerascalibrate_camerasCalibrateCamerascalibrate_camerasCalibrateCamerasCalibrateCameras oder camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration ausgeführt wird.

Das Format der Textdatei ist eine (von HALCON unabhängige) generische Parameterbeschreibung, die beliebige Gruppen von Parametern zu hierarchisch organisierten Parametergruppen (Struktur ParGroup) zusammenfasst. Die Beschreibung eines Parameters innerhalb einer ParGroup enthält in 3 Zeilen folgende Einträge:

   Name : Kurzname : aktueller Wert ;
    Typ : Untere Grenze (optional) : Obere Grenze (optional) ;
    Beschreibung (optional) ;
Kommentare werden durch ein '#' am Zeilenanfang markiert.

read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar erwartet in der Datei CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile eine der beiden folgenden Parametergruppen.

Die Parametergruppe Camera:Parameter enthält die 8 bis 14 internen Kameraparameter des jeweiligen Kameramodells.

Eine solche Datei hat für eine Kamera mit Flächensensor, einem projektiven Objektiv und dem Divisionsmodell z.B. folgendes Aussehen:

  # INTERNAL CAMERA PARAMETERS

  ParGroup: Camera: Parameter;
      "Internal camera parameters";

  Focus:foc:      0.00806039;
      DOUBLE:0.0:;
      "Focal length of the lens [meter]";

  Kappa:kappa:    -2253.5;
      DOUBLE::;
      "Radial distortion coefficient [1/(meter*meter)]";

  Sx:sx:  1.0629e-05;
      DOUBLE:0.0:;
      "Width of a cell on the sensor [meter]";

  Sy:sy:  1.1e-05;
      DOUBLE:0.0:;
      "Height of a cell on the sensor [meter]";

  Cx:cx:  378.236;
      DOUBLE:0.0:;
      "X-coordinate of the image center [pixel]";

  Cy:cy:  297.587;
      DOUBLE:0.0:;
      "Y-coordinate of the image center [pixel]";

  ImageWidth:imgw:    768;
      INT:1:32767;
      "Width of the images [pixel]";

  ImageHeight:imgh:   576;
      INT:1:32767;
      "Height of the images [pixel]";

Für eine Kamera mit Flächensensor, einem telezentrischem Objektiv und dem Polynomialmodell kann sie z.B. folgendermaßen aussehen:

  # INTERNAL CAMERA PARAMETERS

  ParGroup: Camera: Parameter;
      "Internal camera parameters";

  Focus:foc:      0.0;
      DOUBLE:0.0:;
      "Focal length of the lens [meter]";

  Poly1:poly1:   0;
      DOUBLE::;
      "1st polynomial distortion coefficient";

  Poly2:poly2:   0;
      DOUBLE::;
      "2nd polynomial distortion coefficient";

  Poly3:poly3:   0;
      DOUBLE::;
      "3rd polynomial distortion coefficient";

  Poly4:poly4:   0;
      DOUBLE::;
      "4th polynomial distortion coefficient";

  Poly5:poly5:   0;
      DOUBLE::;
      "5th polynomial distortion coefficient";

  Sx:sx:   1.1e-005;
      DOUBLE:0.0:;
      "Width of a cell on the sensor";

  Sy:sy:   1.1e-005;
      DOUBLE:0.0:;
      "Height of a cell on the sensor";

  Cx:cx:   384;
      DOUBLE::;
      "X-coordinate of the image center";

  Cy:cy:   288;
      DOUBLE::;
      "Y-coordinate of the image center";

  ImageWidth:imgw:  768;
      INT:1:32768;
      "Width of the images";

  ImageHeight:imgh:  576;
      INT:1:32768;
      "Height of the images";

Eine solche Datei hat für eine Kamera mit Flächensensor, einem projektiven Tiltobjektiv und dem Divisionsmodell z.B. folgendes Aussehen:

  # INTERNAL CAMERA PARAMETERS

  ParGroup: Camera: Parameter;
      "Internal camera parameters";

  Focus:foc:      0.00806039;
      DOUBLE:0.0:;
      "Focal length of the lens [meter]";

  Kappa:kappa:    -2253.5;
      DOUBLE::;
      "Radial distortion coefficient [1/(meter*meter)]";

  :tilt:      5.547;
      DOUBLE:0.0:;
      "Tilt of the lens [degrees]";

  Rotation:rot:   1.2763;
      DOUBLE:0.0:;
      "Direction of the tilt of the lens [degrees]";

  Sx:sx:  1.0629e-05;
      DOUBLE:0.0:;
      "Width of a cell on the sensor [meter]";

  Sy:sy:  1.1e-05;
      DOUBLE:0.0:;
      "Height of a cell on the sensor [meter]";

  Cx:cx:  378.236;
      DOUBLE:0.0:;
      "X-coordinate of the image center [pixel]";

  Cy:cy:  297.587;
      DOUBLE:0.0:;
      "Y-coordinate of the image center [pixel]";

  ImageWidth:imgw:    768;
      INT:1:32767;
      "Width of the images [pixel]";

  ImageHeight:imgh:   576;
      INT:1:32767;
      "Height of the images [pixel]";

Die Parametergruppe LinescanCamera:Parameter enthält zusätzlich zu den 8 Parametern der Parametergruppe Camera:Paramter mit Divisionsmodell noch 3 Parameter, die die Bewegung der Kamera in Bezug auf das Objekt beschreiben. Somit enthält die Parametergruppe LinescanCamera:Parameter die 11 Parameter Focus, Kappa , Sx, Sy, Cx, Cy, ImageWidth, ImageHeight, Vx, Vy und Vz. Eine solche Datei hat z.B. folgendes Aussehen:

  # INTERNAL CAMERA PARAMETERS

  ParGroup: LinescanCamera: Parameter;
      "Internal camera parameters";

  Focus:foc:      0.061;
      DOUBLE:0.0:;
      "Focal length of the lens [meter]";

  Kappa:kappa:    -16.9761;
      DOUBLE::;
      "Radial distortion coefficient [1/(meter*meter)]";

  Sx:sx:  1.06903e-05;
      DOUBLE:0.0:;
      "Width of a cell on the sensor [meter]";

  Sy:sy:  1e-05;
      DOUBLE:0.0:;
      "Height of a cell on the sensor [meter]";

  Cx:cx:  930.625;
      DOUBLE:0.0:;
      "X-coordinate of the image center [pixel]";

  Cy:cy:  149.962;
      DOUBLE:0.0:;
      "Y-coordinate of the image center [pixel]";

  ImageWidth:imgw:    2048;
      INT:1:32767;
      "Width of the images [pixel]";

  ImageHeight:imgh:   3840;
      INT:1:32767;
      "Height of the images [pixel]";

  Vx:vx:  1.41376e-06;
      DOUBLE::;
      "X-component of the motion vector [meter/scanline]";

  Vy:vy:  5.45756e-05;
      DOUBLE::;
      "Y-component of the motion vector [meter/scanline]";

  Vz:vz:  3.45872e-06;
      DOUBLE::;
      "Z-component of the motion vector [meter/scanline]";

Parallelisierung

Parameter

CamParFileCamParFileCamParFileCamParFileCamParFilecamParFile (input_control)  filename.read HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Dateiname der Kameraparameterdatei.

Defaultwert: 'campar.dat' "campar.dat" "campar.dat" "campar.dat" "campar.dat" "campar.dat"

Werteliste: 'campar.dat'"campar.dat""campar.dat""campar.dat""campar.dat""campar.dat", 'campar.final'"campar.final""campar.final""campar.final""campar.final""campar.final", 'campar.initial'"campar.initial""campar.initial""campar.initial""campar.initial""campar.initial"

Dateiendung: .dat

CameraParamCameraParamCameraParamCameraParamCameraParamcameraParam (output_control)  number-array HTupleHTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong) (double / Hlong)

Interne Kameraparameter.

Parameteranzahl: CameraParam == 8 || CameraParam == 10 || CameraParam == 11 || CameraParam == 12 || CameraParam == 14

Beispiel (HDevelop)

*  get internal camera parameters:
read_cam_par('campar.dat', CameraParam)

Beispiel (HDevelop)

*  get internal camera parameters:
read_cam_par('campar.dat', CameraParam)

Beispiel (HDevelop)

*  get internal camera parameters:
read_cam_par('campar.dat', CameraParam)

Beispiel (C++ (HALCON 5.0-10.0))

HTuple CameraParam;
// get internal camera parameters:
read_cam_par("campar.dat", &CameraParam);

Beispiel (HDevelop)

*  get internal camera parameters:
read_cam_par('campar.dat', CameraParam)

Beispiel (HDevelop)

*  get internal camera parameters:
read_cam_par('campar.dat', CameraParam)

Ergebnis

Sind die Parameterwerte korrekt und konnte die Datei erfolgreich gelesen werden, dann liefert read_cam_parread_cam_parReadCamParread_cam_parReadCamParReadCamPar den Wert 2 (H_MSG_TRUE).

Nachfolger

find_marks_and_posefind_marks_and_poseFindMarksAndPosefind_marks_and_poseFindMarksAndPoseFindMarksAndPose, sim_caltabsim_caltabSimCaltabsim_caltabSimCaltabSimCaltab, gen_caltabgen_caltabGenCaltabgen_caltabGenCaltabGenCaltab, disp_caltabdisp_caltabDispCaltabdisp_caltabDispCaltabDispCaltab, camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration

Siehe auch

find_caltabfind_caltabFindCaltabfind_caltabFindCaltabFindCaltab, find_marks_and_posefind_marks_and_poseFindMarksAndPosefind_marks_and_poseFindMarksAndPoseFindMarksAndPose, camera_calibrationcamera_calibrationCameraCalibrationcamera_calibrationCameraCalibrationCameraCalibration, disp_caltabdisp_caltabDispCaltabdisp_caltabDispCaltabDispCaltab, sim_caltabsim_caltabSimCaltabsim_caltabSimCaltabSimCaltab, write_cam_parwrite_cam_parWriteCamParwrite_cam_parWriteCamParWriteCamPar, write_posewrite_poseWritePosewrite_poseWritePoseWritePose, read_poseread_poseReadPoseread_poseReadPoseReadPose, project_3d_pointproject_3d_pointProject3dPointproject_3d_pointProject3dPointProject3dPoint, get_line_of_sightget_line_of_sightGetLineOfSightget_line_of_sightGetLineOfSightGetLineOfSight

Modul

Foundation


KlassenKlassenKlassenKlassen | | | | Operatoren