Name
binocular_disparitybinocular_disparityBinocularDisparitybinocular_disparityBinocularDisparityBinocularDisparity — Berechnet die Disparität für ein rektifiziertes Bildpaar mit Hilfe von
Korrelationsmethoden.
binocular_disparity(Image1, Image2 : Disparity, Score : Method, MaskWidth, MaskHeight, TextureThresh, MinDisparity, MaxDisparity, NumLevels, ScoreThresh, Filter, SubDisparity : )
Herror binocular_disparity(const Hobject Image1, const Hobject Image2, Hobject* Disparity, Hobject* Score, const char* Method, const Hlong MaskWidth, const Hlong MaskHeight, double TextureThresh, const Hlong MinDisparity, const Hlong MaxDisparity, const Hlong NumLevels, double ScoreThresh, const char* Filter, const char* SubDisparity)
Herror T_binocular_disparity(const Hobject Image1, const Hobject Image2, Hobject* Disparity, Hobject* Score, const Htuple Method, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple TextureThresh, const Htuple MinDisparity, const Htuple MaxDisparity, const Htuple NumLevels, const Htuple ScoreThresh, const Htuple Filter, const Htuple SubDisparity)
Herror binocular_disparity(Hobject Image1, Hobject Image2, Hobject* Disparity, Hobject* Score, const HTuple& Method, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& TextureThresh, const HTuple& MinDisparity, const HTuple& MaxDisparity, const HTuple& NumLevels, const HTuple& ScoreThresh, const HTuple& Filter, const HTuple& SubDisparity)
HImage HImage::BinocularDisparity(const HImage& Image2, HImage* Score, const HTuple& Method, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& TextureThresh, const HTuple& MinDisparity, const HTuple& MaxDisparity, const HTuple& NumLevels, const HTuple& ScoreThresh, const HTuple& Filter, const HTuple& SubDisparity) const
void BinocularDisparity(const HObject& Image1, const HObject& Image2, HObject* Disparity, HObject* Score, const HTuple& Method, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& TextureThresh, const HTuple& MinDisparity, const HTuple& MaxDisparity, const HTuple& NumLevels, const HTuple& ScoreThresh, const HTuple& Filter, const HTuple& SubDisparity)
HImage HImage::BinocularDisparity(const HImage& Image2, HImage* Score, const HString& Method, Hlong MaskWidth, Hlong MaskHeight, const HTuple& TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, const HTuple& ScoreThresh, const HTuple& Filter, const HString& SubDisparity) const
HImage HImage::BinocularDisparity(const HImage& Image2, HImage* Score, const HString& Method, Hlong MaskWidth, Hlong MaskHeight, double TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, double ScoreThresh, const HString& Filter, const HString& SubDisparity) const
HImage HImage::BinocularDisparity(const HImage& Image2, HImage* Score, const char* Method, Hlong MaskWidth, Hlong MaskHeight, double TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, double ScoreThresh, const char* Filter, const char* SubDisparity) const
void HOperatorSetX.BinocularDisparity(
[in] IHUntypedObjectX* Image1, [in] IHUntypedObjectX* Image2, [out] IHUntypedObjectX** Disparity, [out] IHUntypedObjectX** Score, [in] VARIANT Method, [in] VARIANT MaskWidth, [in] VARIANT MaskHeight, [in] VARIANT TextureThresh, [in] VARIANT MinDisparity, [in] VARIANT MaxDisparity, [in] VARIANT NumLevels, [in] VARIANT ScoreThresh, [in] VARIANT Filter, [in] VARIANT SubDisparity)
IHImageX* HImageX.BinocularDisparity(
[in] IHImageX* Image2, [out] IHImageX** Score, [in] BSTR Method, [in] Hlong MaskWidth, [in] Hlong MaskHeight, [in] VARIANT TextureThresh, [in] Hlong MinDisparity, [in] Hlong MaxDisparity, [in] Hlong NumLevels, [in] VARIANT ScoreThresh, [in] VARIANT Filter, [in] BSTR SubDisparity)
static void HOperatorSet.BinocularDisparity(HObject image1, HObject image2, out HObject disparity, out HObject score, HTuple method, HTuple maskWidth, HTuple maskHeight, HTuple textureThresh, HTuple minDisparity, HTuple maxDisparity, HTuple numLevels, HTuple scoreThresh, HTuple filter, HTuple subDisparity)
HImage HImage.BinocularDisparity(HImage image2, out HImage score, string method, int maskWidth, int maskHeight, HTuple textureThresh, int minDisparity, int maxDisparity, int numLevels, HTuple scoreThresh, HTuple filter, string subDisparity)
HImage HImage.BinocularDisparity(HImage image2, out HImage score, string method, int maskWidth, int maskHeight, double textureThresh, int minDisparity, int maxDisparity, int numLevels, double scoreThresh, string filter, string subDisparity)
binocular_disparitybinocular_disparityBinocularDisparitybinocular_disparityBinocularDisparityBinocularDisparity berechnet mit Hilfe von
Korrelationsmethoden pixelweise Korrespondenzen zwischen zwei
rektifizierten Bildern. Im Unterschied zu binocular_distancebinocular_distanceBinocularDistancebinocular_distanceBinocularDistanceBinocularDistance werden
die Ergebnisse nicht in Distanzwerte transformiert.
Der Algorithmus benötigt ein Referenzbild Image1Image1Image1Image1Image1image1 und ein
Suchbild Image2Image2Image2Image2Image2image2, welche entzerrt sein müssen,
d.h. korrespondierende Epipolarlinien liegen parallel und haben
identische Bildzeilenkoordinaten (r1=r2).
Falls diese Annahme nicht zutrifft, können die Bilder durch die
Operatoren calibrate_camerascalibrate_camerasCalibrateCamerascalibrate_camerasCalibrateCamerasCalibrateCameras,
gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMap und map_imagemap_imageMapImagemap_imageMapImageMapImage
entzerrt werden. Ausgehend von einem Pixel im Referenzbild
Image1Image1Image1Image1Image1image1 kann dann das zugehörige Pixel in Image2Image2Image2Image2Image2image2
durch die Suche entlang der korrespondierenden Zeile in
Image2Image2Image2Image2Image2image2 gefunden werden. Eine Übereinstimmung wird gefunden,
indem jeweils eine lokale Nachbarschaft um das entsprechende Pixel
innerhalb eines Fensters der Größe MaskWidthMaskWidthMaskWidthMaskWidthMaskWidthmaskWidth und
MaskHeightMaskHeightMaskHeightMaskHeightMaskHeightmaskHeight in beiden Bildern miteinander verglichen
wird. Die Pixelkorrespondenzen werden in dem einkanaligen Bild
DisparityDisparityDisparityDisparityDisparitydisparity zurückgegeben. Der Grauwert d(r1,c1) beschreibt dabei die Disparität zwischen dem Pixel
(r1,c1) im Referenzbild Image1Image1Image1Image1Image1image1 und dem korrespondierendem
Pixel (r2,c2) im Suchbild Image2Image2Image2Image2Image2image2 und erfüllt somit die Gleichung
c2 = c1 + d(r1,c1). Ein
Qualitätsmaß für die ermittelten Disparitätswerte wird im Bild
ScoreScoreScoreScoreScorescore zurückgegeben,
welches jeweils das beste Ergebnis der Korrelationsfunktion
S für ein Referenzpixel enthält. Für die Korrelation werden die
Grauwerte der originalen, nicht vorverarbeiteten Eingabebilder genutzt.
Die verwendete Korrelationsfunktion wird durch den Parameter
MethodMethodMethodMethodMethodmethod bestimmt, welcher drei Berechnungsmethoden unterscheidet:
-
'sad'"sad""sad""sad""sad""sad": Summed Absolute Differences
S(r1,c1,d) := SUM(|g1(r1',c1')-g2(r1',c1'+d)|), 0=<=S<=255,
-
'ssd'"ssd""ssd""ssd""ssd""ssd": Summed Squared Differences
S(r1,c1,d) := SUM((g1(r1',c1')-g2(r1',c1'+d))²), 0<=S<=65025,
-
'nnc'"nnc""nnc""nnc""nnc""nnc": Normalized Cross Correlation
S(r1,c1,d) :=
SUM(g1(r1',c1')-gm1(r1,c1))*(g2(r1',c1'+d)-gm2(r1,c1+d)))/
SQRT(SUM((g1(r1',c1')-gm1(r1,c1))²)*
SUM((g2(r1',c1+d)-gm2(r1,c1+d))²)),
-1.0<=S<=1.0,
SUM(x) ist die gemittelte Summe von x in einem Fenster der Größe
(2m+1) x (2n+1). gm(r,c) ist der mittlere Grauwert von g(r',c')
in diesem Fenster in Zeile r und Spalte c. g1 und g2 sind Grauwerte in den
nicht vorberarbeiteten Eingabebildern.
Die Methoden 'sad'"sad""sad""sad""sad""sad" und 'ssd'"ssd""ssd""ssd""ssd""ssd" vergleichen
direkt die Grauwerte der Pixel innerhalb des Grauwertfensters, wohingegen
'ncc'"ncc""ncc""ncc""ncc""ncc" den mittleren Grauwert und seine Varianz innerhalb des
Grauwertfensters ausgleicht. Wenn zwei Bilder in ihrer Helligkeit und ihrem
Kontrast unterschiedlich sind, ist daher 'ncc'"ncc""ncc""ncc""ncc""ncc"
vorzuziehen. Ansonsten sind 'sad'"sad""sad""sad""sad""sad" und 'ssd'"ssd""ssd""ssd""ssd""ssd" vorzuziehen,
da sie aufgrund einfacherer interner Berechnungen schneller sind.
Es muss darauf geachtet werden, dass die Güte der Korrelation für
steigende S in den Methoden 'sad'"sad""sad""sad""sad""sad" und
'ssd'"ssd""ssd""ssd""ssd""ssd" fällt (die beste Güte ist 0), während sie in der
Methode 'ncc'"ncc""ncc""ncc""ncc""ncc" steigt (die beste Güte ist 1.0).
Die Größe des Korrelationsfensters, welche durch 2m+1
und 2n+1 in obigen Gleichungen referenziert wird, muss
ungeradzahlig sein und kann durch die Parameter MaskWidthMaskWidthMaskWidthMaskWidthMaskWidthmaskWidth und
MaskHeightMaskHeightMaskHeightMaskHeightMaskHeightmaskHeight festgelegt werden. Der Suchraum wird durch den minimalen
und maximalen Disparitätswert MinDisparityMinDisparityMinDisparityMinDisparityMinDisparityminDisparity und
MaxDisparityMaxDisparityMaxDisparityMaxDisparityMaxDisparitymaxDisparity festgelegt. Da Grauwerte nicht außerhalb des
Bildrandes definiert sind wird die Bildregion des DisparityDisparityDisparityDisparityDisparitydisparity
und ScoreScoreScoreScoreScorescore Bildes am unteren und oberen Bildrand um
(MaskHeightMaskHeightMaskHeightMaskHeightMaskHeightmaskHeight-1)/2 sowie am linken und rechten Rand um
(MaskWidthMaskWidthMaskWidthMaskWidthMaskWidthmaskWidth-1)/2 beschnitten. Aus dem gleichen Grund wird
der maximale Suchraum am linken und rechten Bildrand begrenzt.
Da die Korrelationsverfahren in schwach texturierten Bildregionen im
hohen Maße ungenau werden, kann die kleinste, innerhalb eines
Korrelationsfensters erlaubte Grauwertstreuung mit Hilfe des
Parameters TextureThreshTextureThreshTextureThreshTextureThreshTextureThreshtextureThresh definiert werden. Dieser
Schwellwert wird auf beide Eingabebilder Image1Image1Image1Image1Image1image1 und
Image2Image2Image2Image2Image2image2 angewendet. Zusätzlich garantiert
ScoreThreshScoreThreshScoreThreshScoreThreshScoreThreshscoreThresh eine Mindestgüte der verwendeten
Korrelationsfunktion und legt für die Methoden 'sad'"sad""sad""sad""sad""sad" und
'ssd'"ssd""ssd""ssd""ssd""ssd" den größten, bzw. für 'ncc'"ncc""ncc""ncc""ncc""ncc" den kleinsten
zulässigen Korrelationswert fest. Wird ferner FilterFilterFilterFilterFilterfilter auf
'left_right_check'"left_right_check""left_right_check""left_right_check""left_right_check""left_right_check" gesetzt, werden nur noch diejenigen
Disparitätswerte zurückgegeben, die übereinstimmend bei einer Suche
eines Referenzmusters von Image1Image1Image1Image1Image1image1 in Image2Image2Image2Image2Image2image2 als
auch von Image2Image2Image2Image2Image2image2 in Image1Image1Image1Image1Image1image1 gefunden werden. Der
Wert 'none'"none""none""none""none""none" hingegen schaltet dieses Verhalten aus.
Die Anzahl der Pyramidenstufen, welche verwendet werden um das
Zeitverhalten von binocular_disparitybinocular_disparityBinocularDisparitybinocular_disparityBinocularDisparityBinocularDisparity zu verbessern, wird
durch den Parameter NumLevelsNumLevelsNumLevelsNumLevelsNumLevelsnumLevels bestimmt. Einem grob-zu-fein
Schema folgend werden die Disparitätsbilder der höheren Stufen
berechnet und in rechteckige Bildteile von ähnlicher Disparität
unterteilt um den Suchbereich auf der nächst niedrigeren Stufe für
diesen Bildausschnitt einzuschränken. TextureThreshTextureThreshTextureThreshTextureThreshTextureThreshtextureThresh und
ScoreThreshScoreThreshScoreThreshScoreThreshScoreThreshscoreThresh werden auf jeder Stufe angewendet, so dass die
mit DisparityDisparityDisparityDisparityDisparitydisparity und ScoreScoreScoreScoreScorescore zurückgegebene Bildregion
als die Schnittmenge der Bildregionen auf jeder einzelnen Stufe
definiert ist. Im allgemeinen lohnt sich das Verwenden von
Pyramidenstrukturen um so mehr, je mehr das Disparitätsbild in
homogene Bereiche unterteilt werden kann und je größer der
Disparitätsbereich definiert werden muss. Auf der anderen Seite
können zu hohe Pyramidenstufen durch ihre grobe Auflösung wichtige
Texturinformationen verlieren, so dass falsche Disparitätswerte
zurückgegeben werden können.
Der Wert 'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation" für den Parameter
SubDisparitySubDisparitySubDisparitySubDisparitySubDisparitysubDisparity schließlich berechnet die Disparitäten
Subpixel genau. Das Verhalten wird ausgeschaltet indem der Parameter
auf 'none'"none""none""none""none""none" gesetzt wird.
- Multithreading-Typ: reentrant (läuft parallel zu nicht-exklusiven Operatoren).
- Multithreading-Bereich: global (kann von jedem Thread aufgerufen werden).
- Automatisch parallelisiert auf interner Datenebene.
Rektifiziertes Bild der Kamera 1.
Rektifiziertes Bild der Kamera 2.
Maß für die Zuverlässigkeit eines Disparitätswertes.
Korrespondenzverfahren.
Defaultwert:
'ncc'
"ncc"
"ncc"
"ncc"
"ncc"
"ncc"
Werteliste: 'ncc'"ncc""ncc""ncc""ncc""ncc", 'sad'"sad""sad""sad""sad""sad", 'ssd'"ssd""ssd""ssd""ssd""ssd"
Breite des Korrelationsfensters.
Defaultwert: 11
Wertevorschläge: 5, 7, 9, 11, 21
Restriktion: 3 <= MaskWidth && odd(MaskWidth)
Höhe des Korrelationsfensters.
Defaultwert: 11
Wertevorschläge: 5, 7, 9, 11, 21
Restriktion: 3 <= MaskHeight && odd(MaskHeight)
Schwellwert der Grauwertvarianz.
Defaultwert: 0.0
Wertevorschläge: 0.0, 10.0, 30.0
Restriktion: 0.0 <= TextureThresh
Minimale erwartete Disparität.
Defaultwert: -30
Typischer Wertebereich: -32768
≤
MinDisparity
MinDisparity
MinDisparity
MinDisparity
MinDisparity
minDisparity
≤
32767
Maximale erwartete Disparität.
Defaultwert: 30
Typischer Wertebereich: -32768
≤
MaxDisparity
MaxDisparity
MaxDisparity
MaxDisparity
MaxDisparity
maxDisparity
≤
32767
Anzahl der Pyramidenstufen.
Defaultwert: 1
Wertevorschläge: 1, 2, 3, 4
Restriktion: 1 <= NumLevels
Schwellwert der Korrelation.
Defaultwert: 0.5
Wertevorschläge: -1.0, 0.0, 0.3, 0.5, 0.7
Nachgelagerte Ergebnisfilter.
Defaultwert:
'none'
"none"
"none"
"none"
"none"
"none"
Werteliste: 'left_right_check'"left_right_check""left_right_check""left_right_check""left_right_check""left_right_check", 'none'"none""none""none""none""none"
Sup-Pixel Interpolation der Disparitäten.
Defaultwert:
'none'
"none"
"none"
"none"
"none"
"none"
Werteliste: 'interpolation'"interpolation""interpolation""interpolation""interpolation""interpolation", 'none'"none""none""none""none""none"
* read the internal and external stereo parameters
read_cam_par ('cam_left.dat', CamParam1)
read_cam_par ('cam_right.dat', CamParam2)
read_pose ('relpos.dat', RelPose)
* compute the mapping for rectified images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
1, 'geometric', 'bilinear', CamParamRect1,CamParamRect2, Cam1PoseRect1, \
Cam2PoseRect2,RelPoseRect)
* compute the disparities in online images
while (1)
grab_image_async (Image1, AcqHandle1, -1)
map_image (Image1, Map1, ImageMapped1)
grab_image_async (Image2, AcqHandle2, -1)
map_image (Image2, Map2, ImageMapped2)
binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, 'sad', \
11, 11, 20, -40, 20, 2, 25, 'left_right_check','interpolation')
endwhile
* read the internal and external stereo parameters
read_cam_par ('cam_left.dat', CamParam1)
read_cam_par ('cam_right.dat', CamParam2)
read_pose ('relpos.dat', RelPose)
* compute the mapping for rectified images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
1, 'geometric', 'bilinear', CamParamRect1,CamParamRect2, Cam1PoseRect1, \
Cam2PoseRect2,RelPoseRect)
* compute the disparities in online images
while (1)
grab_image_async (Image1, AcqHandle1, -1)
map_image (Image1, Map1, ImageMapped1)
grab_image_async (Image2, AcqHandle2, -1)
map_image (Image2, Map2, ImageMapped2)
binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, 'sad', \
11, 11, 20, -40, 20, 2, 25, 'left_right_check','interpolation')
endwhile
* read the internal and external stereo parameters
read_cam_par ('cam_left.dat', CamParam1)
read_cam_par ('cam_right.dat', CamParam2)
read_pose ('relpos.dat', RelPose)
* compute the mapping for rectified images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
1, 'geometric', 'bilinear', CamParamRect1,CamParamRect2, Cam1PoseRect1, \
Cam2PoseRect2,RelPoseRect)
* compute the disparities in online images
while (1)
grab_image_async (Image1, AcqHandle1, -1)
map_image (Image1, Map1, ImageMapped1)
grab_image_async (Image2, AcqHandle2, -1)
map_image (Image2, Map2, ImageMapped2)
binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, 'sad', \
11, 11, 20, -40, 20, 2, 25, 'left_right_check','interpolation')
endwhile
// read the internal and external stereo parameters
read_cam_par("cam_left.dat",CamParam1);
read_cam_par("cam_right.dat",CamParam2);
read_pose("relpos.dat",RelPose);
// compute the mapping for rectified images
gen_binocular_rectification_map(&Map1,&Map2,CamParam1,CamParam2,RelPose,1,
"geometric","bilinear",&CamParamRect1,
&CamParamRect2,&CamPoseRect1,&CamPoseRect2,
&RelPosRect);
// compute the disparities in online images
while (1)
{
grab_image_async(&Image1,AcqHandle1,-1);
map_image(Image1,Map1,&ImageMapped1);
grab_image_async(&Image2,AcqHandle2,-1);
map_image(Image2,Map2,&ImageMapped2);
binocular_disparity(ImageMapped1,ImageMapped2,&Disparity,&Score,"sad",
11,11,20,-40,20,2,25,"left_right_check",
"interpolation");
}
* read the internal and external stereo parameters
read_cam_par ('cam_left.dat', CamParam1)
read_cam_par ('cam_right.dat', CamParam2)
read_pose ('relpos.dat', RelPose)
* compute the mapping for rectified images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
1, 'geometric', 'bilinear', CamParamRect1,CamParamRect2, Cam1PoseRect1, \
Cam2PoseRect2,RelPoseRect)
* compute the disparities in online images
while (1)
grab_image_async (Image1, AcqHandle1, -1)
map_image (Image1, Map1, ImageMapped1)
grab_image_async (Image2, AcqHandle2, -1)
map_image (Image2, Map2, ImageMapped2)
binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, 'sad', \
11, 11, 20, -40, 20, 2, 25, 'left_right_check','interpolation')
endwhile
* read the internal and external stereo parameters
read_cam_par ('cam_left.dat', CamParam1)
read_cam_par ('cam_right.dat', CamParam2)
read_pose ('relpos.dat', RelPose)
* compute the mapping for rectified images
gen_binocular_rectification_map (Map1, Map2, CamParam1, CamParam2, RelPose, \
1, 'geometric', 'bilinear', CamParamRect1,CamParamRect2, Cam1PoseRect1, \
Cam2PoseRect2,RelPoseRect)
* compute the disparities in online images
while (1)
grab_image_async (Image1, AcqHandle1, -1)
map_image (Image1, Map1, ImageMapped1)
grab_image_async (Image2, AcqHandle2, -1)
map_image (Image2, Map2, ImageMapped2)
binocular_disparity(ImageMapped1, ImageMapped2, Disparity, Score, 'sad', \
11, 11, 20, -40, 20, 2, 25, 'left_right_check','interpolation')
endwhile
Sind die Parameterwerte korrekt, dann liefert
binocular_disparitybinocular_disparityBinocularDisparitybinocular_disparityBinocularDisparityBinocularDisparity den Wert 2 (H_MSG_TRUE).
map_imagemap_imageMapImagemap_imageMapImageMapImage
thresholdthresholdThresholdthresholdThresholdThreshold,
disparity_to_distancedisparity_to_distanceDisparityToDistancedisparity_to_distanceDisparityToDistanceDisparityToDistance,
disparity_image_to_xyzdisparity_image_to_xyzDisparityImageToXyzdisparity_image_to_xyzDisparityImageToXyzDisparityImageToXyz
binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMg,
binocular_distancebinocular_distanceBinocularDistancebinocular_distanceBinocularDistanceBinocularDistance,
binocular_distance_mgbinocular_distance_mgBinocularDistanceMgbinocular_distance_mgBinocularDistanceMgBinocularDistanceMg
map_imagemap_imageMapImagemap_imageMapImageMapImage,
gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMap,
binocular_calibrationbinocular_calibrationBinocularCalibrationbinocular_calibrationBinocularCalibrationBinocularCalibration
3D Metrology