radial_distortion_self_calibrationT_radial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration (Operator)

Name

radial_distortion_self_calibrationT_radial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration — Kalibrieren der radialen Verzeichnung.

Signatur

radial_distortion_self_calibration(Contours : SelectedContours : Width, Height, InlierThreshold, RandSeed, DistortionModel, DistortionCenter, PrincipalPointVar : CameraParam)

Herror T_radial_distortion_self_calibration(const Hobject Contours, Hobject* SelectedContours, const Htuple Width, const Htuple Height, const Htuple InlierThreshold, const Htuple RandSeed, const Htuple DistortionModel, const Htuple DistortionCenter, const Htuple PrincipalPointVar, Htuple* CameraParam)

void RadialDistortionSelfCalibration(const HObject& Contours, HObject* SelectedContours, const HTuple& Width, const HTuple& Height, const HTuple& InlierThreshold, const HTuple& RandSeed, const HTuple& DistortionModel, const HTuple& DistortionCenter, const HTuple& PrincipalPointVar, HTuple* CameraParam)

HXLDCont HXLDCont::RadialDistortionSelfCalibration(Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const HString& DistortionModel, const HString& DistortionCenter, double PrincipalPointVar, HCamPar* CameraParam) const

HXLDCont HXLDCont::RadialDistortionSelfCalibration(Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const char* DistortionModel, const char* DistortionCenter, double PrincipalPointVar, HCamPar* CameraParam) const

HXLDCont HXLDCont::RadialDistortionSelfCalibration(Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const wchar_t* DistortionModel, const wchar_t* DistortionCenter, double PrincipalPointVar, HCamPar* CameraParam) const   (Nur Windows)

HXLDCont HCamPar::RadialDistortionSelfCalibration(const HXLDCont& Contours, Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const HString& DistortionModel, const HString& DistortionCenter, double PrincipalPointVar)

HXLDCont HCamPar::RadialDistortionSelfCalibration(const HXLDCont& Contours, Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const char* DistortionModel, const char* DistortionCenter, double PrincipalPointVar)

HXLDCont HCamPar::RadialDistortionSelfCalibration(const HXLDCont& Contours, Hlong Width, Hlong Height, double InlierThreshold, Hlong RandSeed, const wchar_t* DistortionModel, const wchar_t* DistortionCenter, double PrincipalPointVar)   (Nur Windows)

static void HOperatorSet.RadialDistortionSelfCalibration(HObject contours, out HObject selectedContours, HTuple width, HTuple height, HTuple inlierThreshold, HTuple randSeed, HTuple distortionModel, HTuple distortionCenter, HTuple principalPointVar, out HTuple cameraParam)

HXLDCont HXLDCont.RadialDistortionSelfCalibration(int width, int height, double inlierThreshold, int randSeed, string distortionModel, string distortionCenter, double principalPointVar, out HCamPar cameraParam)

HXLDCont HCamPar.RadialDistortionSelfCalibration(HXLDCont contours, int width, int height, double inlierThreshold, int randSeed, string distortionModel, string distortionCenter, double principalPointVar)

def radial_distortion_self_calibration(contours: HObject, width: int, height: int, inlier_threshold: float, rand_seed: int, distortion_model: str, distortion_center: str, principal_point_var: float) -> Tuple[HObject, Sequence[Union[int, float, str]]]

Beschreibung

radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration berechnet die Verzeichnungsparameter sowie das Verzeichnungszentrum eines Objektivs basierend auf den in ContoursContoursContoursContourscontourscontours übergebenen XLD-Konturen.

Die Verzeichnungswerte werden in CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param zurückgegeben. Da keine weiteren Parameter geschätzt werden - insbesondere nicht die Brennweite oder der Vergrößerungsmaßstab - wird ein telezentrisches Kameramodell mit Vergrößerungsmaßstab 1 und Skalierungsfaktor 1 für und zurückgegeben. Siehe Kalibrierung für mehr Informationen zu den verschiedenen Kameramodellen.

Anwendung

Mit dem Ergebnis von radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration kann man die Objektivverzeichnungen in Bildern korrigieren. Hierzu muss man den Parameter CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param, der die Verzeichnungsparameter enthält, an die Operatoren change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par und change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImagechange_radial_distortion_image weiterreichen.

Grundprinzip

Die Bestimmung der Verzeichnung basiert auf der Annahme, dass in der aufgenommen Szene eine signifikante Anzahl von geraden Kanten oder Linien vorhanden ist. Durch die Linsenverzeichnung werden diese Geraden auf gekrümmte Linien abgebildet. Es werden nun geeignete Parameter gesucht, die diese gekrümmten Linien wieder auf Geraden abbilden und somit die Verzeichnung kompensieren.

Eingabekonturen extrahieren

Um geeignete Eingabekonturen ContoursContoursContoursContourscontourscontours zu erhalten, kann man z.B. edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix oder lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss verwenden. Die Konturen sollten im Bild gleichverteilt und möglichst in der Nähe des Bildrands liegen, da sich dort die Verzeichnung am stärksten auswirkt und damit die Kalibrierung am stabilsten wird. Zur Verbesserung von Laufzeit oder Robustheit können Sie versuchen, z.B. mit segment_contours_xldsegment_contours_xldSegmentContoursXldSegmentContoursXldSegmentContoursXldsegment_contours_xld, union_collinear_contours_xldunion_collinear_contours_xldUnionCollinearContoursXldUnionCollinearContoursXldUnionCollinearContoursXldunion_collinear_contours_xld, union_cocircular_contours_xldunion_cocircular_contours_xldUnionCocircularContoursXldUnionCocircularContoursXldUnionCocircularContoursXldunion_cocircular_contours_xld oder select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldSelectShapeXldselect_shape_xld möglichst lange gerade oder kreisförmige Segmente zu erhalten. Falls in einem einzelnen Bild nicht ausreichend viele gerade Konturen in der Szene vorhanden sind, können Sie auch die Konturen aus mehreren Bildern übergeben (concat_objconcat_objConcatObjConcatObjConcatObjconcat_obj).

Parameter für die Konturauswahl setzen

Der Operator bestimmt automatisch über ein robustes RANSAC-Verfahren jene Konturen aus ContoursContoursContoursContourscontourscontours, die das Abbild von Raumgeraden sind. Die Konturen, die diese Forderung nicht erfüllen und somit für den Kalibrierprozess ungeeignet sind, werden als Ausreißer bezeichnet. Der Operator geht von einer maximalen Ausreißerquote von 50 Prozent aus. Eine Kontur wird als Ausreißer klassifiziert, falls die mittlere Abweichung der Kontur von einer Geraden nach der Verzeichnungskorrektur den maximalen Schwellenwert T überschreitet: Der Wert InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold beschreibt die mittlere Abweichung der Kontur von einer Geraden in Pixeln bei einer Kontur mit 100 Konturpunkten. Der eigentliche Schwellenwert T entsteht durch die Skalierung von InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold mit der Referenzlänge (100) und der Konturpunktanzahl m, um bei geometrisch ähnlichen Konturen die gleiche Kontur-Klassifizierung zu erreichen. Die typischen Werte für InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold liegen zwischen 0.05 und 0.5. Je höher der Wert, desto mehr Abweichungen werden toleriert. Wird für InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold der Wert 0 eingegeben, werden sämtliche Konturen ContoursContoursContoursContourscontourscontours zur Kalibrierung verwendet. Die RANSAC-Konturauswahl wird dadurch unterdrückt, so dass eine manuelle Auswahl der Konturen möglich ist. Dies ist beispielsweise dann hilfreich, wenn die Ausreißerquote über 50 Prozent liegt.

Mit dem Parameter RandSeedRandSeedRandSeedRandSeedrandSeedrand_seed kann das randomisierte Verhalten des RANSAC-Verfahrens beeinflusst werden, um reproduzierbare Ergebnisse zu erhalten. Wird RandSeedRandSeedRandSeedRandSeedrandSeedrand_seed auf einen positiven Wert gesetzt, so liefert der Operator bei jedem Aufruf mit denselben Parametern auch dasselbe Resultat, da der intern verwendete Zufallsgenerator mit RandSeedRandSeedRandSeedRandSeedrandSeedrand_seed initialisiert wird.

radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration gibt die Konturen, die zur Kalibrierung verwendet wurden in SelectedContoursSelectedContoursSelectedContoursSelectedContoursselectedContoursselected_contours die zurück.

Verzeichnungsmodell auswählen

Das zur Kalibrierung verwendete Verzeichnungsmodell kann über DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model gewählt werden. Beim Divisionsmodell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model = 'division'"division""division""division""division""division") werden die Verzeichnungen über den Verzeichnungsparameter beschrieben. Beim polynomiellen Modell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model = 'polynomial'"polynomial""polynomial""polynomial""polynomial""polynomial") werden die Verzeichnungen über die radialen Verzeichnungsparameter und die tangentialen Verzeichnungsparameter beschrieben. Siehe Kalibrierung für mehr Informationen zu den verschiedenen Kameramodellen.

Parameter zur Bestimmung des Verzeichnungszentrums einstellen

Als Startpunkt für die Bestimmung des Verzeichnungszentrums wird die Bildmitte verwendet; die Bildgröße wird über WidthWidthWidthWidthwidthwidth und HeightHeightHeightHeightheightheight definiert.

Zur Bestimmung der Verzeichnungsparameter beziehungsweise stehen die Methoden 'variable'"variable""variable""variable""variable""variable", 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive" und 'fixed'"fixed""fixed""fixed""fixed""fixed" zur Verfügung, die über den Parameter DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center ausgewählt werden:

'variable'

Bei der Vorauswahl 'variable'"variable""variable""variable""variable""variable" wird von Beginn an mit variablen Verzeichnungszentrum c kalibriert. Hierbei sollten viele gleichmäßig verteilte Konturen in der Nähe des Bildrandes vorliegen oder die Verzeichnung möglichst stark sein, da ansonsten das Verzeichnungszentrum nicht bestimmt werden kann und dies zur Instabilität führt.

'adaptive'

Bei der Variante 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive" wird zunächst das Verzeichnungszentrum c fest in der Bildmitte angenommen und die Ausreißer mit dem Schwellenwert InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold eliminiert. In einem letzten Schritt wird dann eine Kalibrierung mit allen Verzeichnungsparametern beziehungsweise durchgeführt, die dann angenommen wird, falls als eine stabile Lösung in der Nähe der Bildmitte gefunden wurde. Andernfalls wird c in der Bildmitte angenommen. Diese Methode sollte dann verwendet werden, wenn das Verzeichnungszentrum außerhalb der Bildmitte gesucht werden soll, jedoch wenige Konturen zur Verfügung stehen oder die Lage der Konturen ungünstig ist (Bsp.: Konturen verlaufen in gleiche Richtung oder liegen im selben Bildbereich).

'fixed'

Bei 'fixed'"fixed""fixed""fixed""fixed""fixed" wird schließlich das Verzeichnungszentrum als konstant in der Bildmitte angenommen und nur beziehungsweise bestimmt. Diese Methode sollte bei sehr schwachen Verzeichnungen und wenigen Konturen in schlechter Lage angewendet werden.

Über den Parameter PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var kann bei den Methoden 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive" und 'variable'"variable""variable""variable""variable""variable" schließlich die Abweichung von c von der Bildmitte gesteuert werden. Falls die Abweichung gesteuert werden soll, muss PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var zwischen 1 und 100 liegen. Dabei gilt: Je höher der Wert, umso mehr darf c von der Bildmitte abweichen. Liegt der Wert bei 0, findet keine Steuerung statt, d.h. der Hauptpunkt wird alleine durch die Konturen bestimmt. Generell sollte die Steuerung über PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var bei schwachen Verzeichnungen und ähnlich orientierten Konturen verwendet werden, da sonst unter Umständen keine stabile Lösung gefunden wird.

Laufzeit

Die Laufzeit von radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration ist für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'variable'"variable""variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var = 0 am geringsten. Die Laufzeit für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'variable'"variable""variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var > 0 steigt mit kleineren Werten von PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var signifikant an. Die Laufzeiten für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive" und DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'fixed'"fixed""fixed""fixed""fixed""fixed" sind auch signifikant höher als bei DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'variable'"variable""variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var = 0.

Achtung

Da das polynomielle Modell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model = 'polynomial'"polynomial""polynomial""polynomial""polynomial""polynomial") mehr Parameter enthält als das Divisionsmodell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model = 'division'"division""division""division""division""division"), kann die Kalibrierung über das polynomielle Modell eine etwas geringere Stabilität aufweisen als die Kalibrierung über das Divisionsmodell. Dies macht sich besonders bei der Bestimmung der tangentialen Verzeichnungskomponenten bemerkbar. Die Stabilität kann verbessert werden, indem man Konturen aus mehreren Bildern verwendet. Zusätzliche Stabilität erhält man wie oben bereits erwähnt für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'fixed'"fixed""fixed""fixed""fixed""fixed", DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center = 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive" oder PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var > 0.

Ausführungsinformationen

Parameter

ContoursContoursContoursContourscontourscontours (input_object)  xld_cont-array objectHXLDContHObjectHXLDContHobject

Konturen, die für die Kalibrierung zur Verfügung stehen.

SelectedContoursSelectedContoursSelectedContoursSelectedContoursselectedContoursselected_contours (output_object)  xld_cont-array objectHXLDContHObjectHXLDContHobject *

Konturen, die zur Kalibrierung verwendet wurden

WidthWidthWidthWidthwidthwidth (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite der Bilder, aus denen die Konturen extrahiert wurden.

Defaultwert: 640

Wertevorschläge: 640, 768

Restriktion: Width > 0

HeightHeightHeightHeightheightheight (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe der Bilder, aus denen die Konturen extrahiert wurden.

Defaultwert: 480

Wertevorschläge: 480, 576

Restriktion: Height > 0

InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThresholdinlier_threshold (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Schwellenwert zur Klassifizierung von Ausreißern.

Defaultwert: 0.05

Wertevorschläge: 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1

Restriktion: InlierThreshold >= 0

RandSeedRandSeedRandSeedRandSeedrandSeedrand_seed (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Initialisierungswert für den Zufallszahlengenerator.

Defaultwert: 42

DistortionModelDistortionModelDistortionModelDistortionModeldistortionModeldistortion_model (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Legt das Verzeichnungsmodell fest.

Defaultwert: 'division' "division" "division" "division" "division" "division"

Werteliste: 'division'"division""division""division""division""division", 'polynomial'"polynomial""polynomial""polynomial""polynomial""polynomial"

DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenterdistortion_center (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Legt fest, wie das Verzeichnungszentrum bestimmt wird.

Defaultwert: 'variable' "variable" "variable" "variable" "variable" "variable"

Werteliste: 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive", 'fixed'"fixed""fixed""fixed""fixed""fixed", 'variable'"variable""variable""variable""variable""variable"

PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVarprincipal_point_var (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Steuert die Abweichung des Verzeichnungszentrums von der Bildmitte; größere Werte erlauben größere Abweichungen; 0 schaltet den Strafterm ab.

Defaultwert: 0.0

Wertevorschläge: 0.0, 5.0, 10.0, 20.0, 50.0, 100.0

Restriktion: PrincipalPointVar >= 0.0 && PrincipalPointVar <= 100.0

CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param (output_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Interne Kameraparameter.

Beispiel (HDevelop)

* Assume that GrayImage is one image in gray values with a
* resolution of 640 x 480 and a suitable number of contours.  Then
* the following example performs the calibration using these
* contours and corrects the image with the estimated distortion
* parameters.
edges_sub_pix (GrayImage, Edges, 'canny', 1.0, 20, 40)
segment_contours_xld (Edges, ContoursSplit, 'lines_circles', 5, 8, 4)
radial_distortion_self_calibration (ContoursSplit, SelectedContours, \
                                    640, 480, 0.08, 42, 'division', \
                                    'variable', 0, CameraParam)
get_domain (GrayImage, Domain)
change_radial_distortion_cam_par ('fullsize', CameraParam, 0, CamParamOut)
change_radial_distortion_image (GrayImage, Domain, ImageRectified, \
                                CameraParam, CamParamOut)

Ergebnis

Sind die Parameterwerte korrekt, dann liefert radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationradial_distortion_self_calibration den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, segment_contours_xldsegment_contours_xldSegmentContoursXldSegmentContoursXldSegmentContoursXldsegment_contours_xld

Nachfolger

change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamParchange_radial_distortion_cam_par, change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImagechange_radial_distortion_image

Siehe auch

camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration

Literatur

T. Thormählen, H. Broszio: „Automatic line-based estimation of radial lens distortion“; in: Integrated Computer-Aided Engineering; vol. 12; pp. 177-190; 2005.

Modul

Calibration