radial_distortion_self_calibrationT_radial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration (Operator)

Name

radial_distortion_self_calibrationT_radial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration — 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)

Beschreibung

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

Die Verzeichnungswerte werden in CameraParamCameraParamCameraParamCameraParamcameraParam 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_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration kann man die Objektivverzeichnungen in Bildern korrigieren. Hierzu muss man den Parameter CameraParamCameraParamCameraParamCameraParamcameraParam, der die Verzeichnungsparameter enthält, an die Operatoren change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamPar und change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImage 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 ContoursContoursContoursContourscontours zu erhalten, kann man z.B. edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix oder lines_gausslines_gaussLinesGaussLinesGaussLinesGauss 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_xldSegmentContoursXldSegmentContoursXldSegmentContoursXld, union_collinear_contours_xldunion_collinear_contours_xldUnionCollinearContoursXldUnionCollinearContoursXldUnionCollinearContoursXld, union_cocircular_contours_xldunion_cocircular_contours_xldUnionCocircularContoursXldUnionCocircularContoursXldUnionCocircularContoursXld oder select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldSelectShapeXld 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_objConcatObjConcatObjConcatObj).

Parameter für die Konturauswahl setzen

Der Operator bestimmt automatisch über ein robustes RANSAC-Verfahren jene Konturen aus ContoursContoursContoursContourscontours, 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 Schwellwert T überschreitet: Der Wert InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold beschreibt die mittlere Abweichung der Kontur von einer Geraden in Pixeln bei einer Kontur mit 100 Konturpunkten. Der eigentliche Schwellwert T entsteht durch die Skalierung von InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold mit der Referenzlänge (100) und der Konturpunktzahl m, um bei geometrisch ähnlichen Konturen die gleiche Kontur-Klassifizierung zu erreichen. Die typischen Werte für InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold liegen zwischen 0.05 und 0.5. Je höher der Wert, desto mehr Abweichungen werden toleriert. Wird für InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold der Wert 0 eingegeben, werden sämtliche Konturen ContoursContoursContoursContourscontours 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 RandSeedRandSeedRandSeedRandSeedrandSeed kann das randomisierte Verhalten des RANSAC-Verfahrens beeinflusst werden, um reproduzierbare Ergebnisse zu erhalten. Wird RandSeedRandSeedRandSeedRandSeedrandSeed auf einen positiven Wert gesetzt, so liefert der Operator bei jedem Aufruf mit denselben Parametern auch dasselbe Resultat, da der intern verwendete Zufallsgenerator mit RandSeedRandSeedRandSeedRandSeedrandSeed initialisiert wird.

radial_distortion_self_calibrationradial_distortion_self_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration gibt die Konturen, die zur Kalibrierung verwendet wurden in SelectedContoursSelectedContoursSelectedContoursSelectedContoursselectedContours die zurück.

Verzeichnungsmodell auswählen

Das zur Kalibrierung verwendete Verzeichnungsmodell kann über DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel gewählt werden. Beim Divisionsmodell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel = 'division'"division""division""division""division") werden die Verzeichnungen über den Verzeichnungsparameter beschrieben. Beim polynomiellen Modell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel = '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 WidthWidthWidthWidthwidth und HeightHeightHeightHeightheight definiert.

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

'variable'

Bei der Vorauswahl '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" wird zunächst das Verzeichnungszentrum c fest in der Bildmitte angenommen und die Ausreißer mit dem Schwellwert InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold 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" 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 PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar kann bei den Methoden 'adaptive'"adaptive""adaptive""adaptive""adaptive" und 'variable'"variable""variable""variable""variable" schließlich die Abweichung von c von der Bildmitte gesteuert werden. Falls die Abweichung gesteuert werden soll, muss PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar 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 PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar 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_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration ist für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'variable'"variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar = 0 am geringsten. Die Laufzeit für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'variable'"variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar > 0 steigt mit kleineren Werten von PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar signifikant an. Die Laufzeiten für DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'adaptive'"adaptive""adaptive""adaptive""adaptive" und DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'fixed'"fixed""fixed""fixed""fixed" sind auch signifikant höher als bei DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'variable'"variable""variable""variable""variable" und PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar = 0.

Achtung

Da das polynomielle Modell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel = 'polynomial'"polynomial""polynomial""polynomial""polynomial") mehr Parameter enthält als das Divisionsmodell (DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel = '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 DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'fixed'"fixed""fixed""fixed""fixed", DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter = 'adaptive'"adaptive""adaptive""adaptive""adaptive" oder PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar > 0.

Ausführungsinformationen

Parameter

ContoursContoursContoursContourscontours (input_object)  xld_cont-array objectHXLDContHXLDContHobject

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

SelectedContoursSelectedContoursSelectedContoursSelectedContoursselectedContours (output_object)  xld_cont-array objectHXLDContHXLDContHobject *

Konturen, die zur Kalibrierung verwendet wurden

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite der Bilder, aus denen die Konturen extrahiert wurden.

Defaultwert: 640

Wertevorschläge: 640, 768

Restriktion: Width > 0

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

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

Defaultwert: 480

Wertevorschläge: 480, 576

Restriktion: Height > 0

InlierThresholdInlierThresholdInlierThresholdInlierThresholdinlierThreshold (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Schwellwert 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

RandSeedRandSeedRandSeedRandSeedrandSeed (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Initialisierungswert für den Zufallszahlengenerator.

Defaultwert: 42

DistortionModelDistortionModelDistortionModelDistortionModeldistortionModel (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Legt das Verzeichnungsmodell fest.

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

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

DistortionCenterDistortionCenterDistortionCenterDistortionCenterdistortionCenter (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Legt fest, wie das Verzeichnungszentrum bestimmt wird.

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

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

PrincipalPointVarPrincipalPointVarPrincipalPointVarPrincipalPointVarprincipalPointVar (input_control)  real HTupleHTupleHtuple (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

CameraParamCameraParamCameraParamCameraParamcameraParam (output_control)  campar HCamPar, HTupleHTupleHtuple (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_calibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibrationRadialDistortionSelfCalibration den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix, segment_contours_xldsegment_contours_xldSegmentContoursXldSegmentContoursXldSegmentContoursXld

Nachfolger

change_radial_distortion_cam_parchange_radial_distortion_cam_parChangeRadialDistortionCamParChangeRadialDistortionCamParChangeRadialDistortionCamPar, change_radial_distortion_imagechange_radial_distortion_imageChangeRadialDistortionImageChangeRadialDistortionImageChangeRadialDistortionImage

Siehe auch

camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibration

Literatur

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

Modul

Calibration