gen_binocular_proj_rectificationT_gen_binocular_proj_rectificationGenBinocularProjRectificationGenBinocularProjRectificationgen_binocular_proj_rectification (Operator)

Name

gen_binocular_proj_rectificationT_gen_binocular_proj_rectificationGenBinocularProjRectificationGenBinocularProjRectificationgen_binocular_proj_rectification — Projektive Rektifizierung eines schwach kalibrierten Stereo-Bildpaares.

Signatur

gen_binocular_proj_rectification( : Map1, Map2 : FMatrix, CovFMat, Width1, Height1, Width2, Height2, SubSampling, Mapping : CovFMatRect, H1, H2)

Herror T_gen_binocular_proj_rectification(Hobject* Map1, Hobject* Map2, const Htuple FMatrix, const Htuple CovFMat, const Htuple Width1, const Htuple Height1, const Htuple Width2, const Htuple Height2, const Htuple SubSampling, const Htuple Mapping, Htuple* CovFMatRect, Htuple* H1, Htuple* H2)

void GenBinocularProjRectification(HObject* Map1, HObject* Map2, const HTuple& FMatrix, const HTuple& CovFMat, const HTuple& Width1, const HTuple& Height1, const HTuple& Width2, const HTuple& Height2, const HTuple& SubSampling, const HTuple& Mapping, HTuple* CovFMatRect, HTuple* H1, HTuple* H2)

HImage HImage::GenBinocularProjRectification(const HHomMat2D& FMatrix, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, const HTuple& SubSampling, const HString& Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2)

HImage HImage::GenBinocularProjRectification(const HHomMat2D& FMatrix, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const HString& Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2)

HImage HImage::GenBinocularProjRectification(const HHomMat2D& FMatrix, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const char* Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2)

HImage HImage::GenBinocularProjRectification(const HHomMat2D& FMatrix, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const wchar_t* Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2)   (Nur Windows)

HImage HHomMat2D::GenBinocularProjRectification(HImage* Map2, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, const HTuple& SubSampling, const HString& Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2) const

HImage HHomMat2D::GenBinocularProjRectification(HImage* Map2, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const HString& Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2) const

HImage HHomMat2D::GenBinocularProjRectification(HImage* Map2, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const char* Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2) const

HImage HHomMat2D::GenBinocularProjRectification(HImage* Map2, const HTuple& CovFMat, Hlong Width1, Hlong Height1, Hlong Width2, Hlong Height2, Hlong SubSampling, const wchar_t* Mapping, HTuple* CovFMatRect, HHomMat2D* H1, HHomMat2D* H2) const   (Nur Windows)

static void HOperatorSet.GenBinocularProjRectification(out HObject map1, out HObject map2, HTuple FMatrix, HTuple covFMat, HTuple width1, HTuple height1, HTuple width2, HTuple height2, HTuple subSampling, HTuple mapping, out HTuple covFMatRect, out HTuple h1, out HTuple h2)

HImage HImage.GenBinocularProjRectification(HHomMat2D FMatrix, HTuple covFMat, int width1, int height1, int width2, int height2, HTuple subSampling, string mapping, out HTuple covFMatRect, out HHomMat2D h1, out HHomMat2D h2)

HImage HImage.GenBinocularProjRectification(HHomMat2D FMatrix, HTuple covFMat, int width1, int height1, int width2, int height2, int subSampling, string mapping, out HTuple covFMatRect, out HHomMat2D h1, out HHomMat2D h2)

HImage HHomMat2D.GenBinocularProjRectification(out HImage map2, HTuple covFMat, int width1, int height1, int width2, int height2, HTuple subSampling, string mapping, out HTuple covFMatRect, out HHomMat2D h1, out HHomMat2D h2)

HImage HHomMat2D.GenBinocularProjRectification(out HImage map2, HTuple covFMat, int width1, int height1, int width2, int height2, int subSampling, string mapping, out HTuple covFMatRect, out HHomMat2D h1, out HHomMat2D h2)

def gen_binocular_proj_rectification(fmatrix: Sequence[Union[float, int]], cov_fmat: Sequence[Union[float, int]], width_1: int, height_1: int, width_2: int, height_2: int, sub_sampling: Union[int, float], mapping: str) -> Tuple[HObject, HObject, Sequence[float], Sequence[float], Sequence[float]]

Beschreibung

Eine binokulare Stereokonfiguration wird schwach kalibriert genannt, wenn die Fundamental-Matrix, welche die projektive Beziehung der beiden Bilder beschreibt, bekannt ist. Rektifizierung ist das Finden eines geeigneten Satzes von Transformationen, welcher die beiden Bilder derart transformiert, dass alle korrespondierenden Epipolargeraden identisch sind und parallel zur horizontalen Achse verlaufen. Rektifizierte Bilder erscheinen vergleichbar einer Stereoanordnung, bei der die linke und rechte Bildebene identisch sind und die relative Lage der Kamerazentren nur aus einer horizontalen Translation besteht. Eine Rektifizierung ist nur möglich, wenn beide Epipole außerhalb der Bildbereiche liegen.

Typischerweise wird die Fundamental-Matrix FMatrixFMatrixFMatrixFMatrixFMatrixfmatrix vorher durch den Operator match_fundamental_matrix_ransacmatch_fundamental_matrix_ransacMatchFundamentalMatrixRansacMatchFundamentalMatrixRansacMatchFundamentalMatrixRansacmatch_fundamental_matrix_ransac berechnet. Ausgehend von der Fundamental-Matrix werden die beiden Homographien (d.h. projektive Transformationen) H1H1H1H1h1h1 und H2H2H2H2h2h2 berechnet, welche die Rektifizierung der beiden Bilder beschreiben. Da die projektive Rektifizierung ein unterbestimmtes Problem darstellt, werden zusätzliche Bedingungen aufgestellt: Es werden diejenigen Transformation gewählt, welche die projektive Verzerrung minimal halten. Für diese Berechnung sind die Dimensionen der Bildbereiche Width1Width1Width1Width1width1width_1,Height1Height1Height1Height1height1height_1, Width2Width2Width2Width2width2width_2 und Height2Height2Height2Height2height2height_2 notwendig. Nach der Rektifizierung hat die Fundamental-Matrix immer folgende kanonische Form:

Ist die Kovarianzmatrix CovFMatCovFMatCovFMatCovFMatcovFMatcov_fmat der Fundamental-Matrix FMatrixFMatrixFMatrixFMatrixFMatrixfmatrix bekannt, so wird auch die Kovarianzmatrix CovFMatRectCovFMatRectCovFMatRectCovFMatRectcovFMatRectcov_fmat_rect der obigen rektifizierten Fundamental-Matrix berechnet. Im Rahmen eines nachfolgenden Stereo-Matchings kann diese dazu dienen den Matching Prozess zu verbessern, da die Kovarianzmatrix den Bereich angibt, wo ein korrespondierender Match zu finden ist.

Ähnlich des verwandten Operators gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map beschreiben die Ausgabebilder Map1Map1Map1Map1map1map_1 und Map2Map2Map2Map2map2map_2 die Transformationen, welche das Stereobildpaar rektifizieren. Der Parameter MappingMappingMappingMappingmappingmapping gibt an, ob für die Abbildung bilineare Interpolation ('bilinear_map'"bilinear_map""bilinear_map""bilinear_map""bilinear_map""bilinear_map") verwendet werden soll, oder ob einfach der nächste Nachbar ('nn_map'"nn_map""nn_map""nn_map""nn_map""nn_map") zu wählen ist. Die Größe bzw. Auflösung der Abbildungskarten ist über SubSamplingSubSamplingSubSamplingSubSamplingsubSamplingsub_sampling einzustellen. Ein Wert von zum Beispiel 2 halbiert die Bildgröße. Wenn nur die Homographien und nicht die Abbildungskarten gewünscht sind, ist die Option MappingMappingMappingMappingmappingmapping auf 'no_map'"no_map""no_map""no_map""no_map""no_map" zu setzen. Unter dem Aspekt der Rechengeschwindigkeit ist diese Wahl zu bevorzugen, wenn für eine spezifische Stereokonfiguration nur ein Bildpaar rektifiziert werden soll. Wenn dagegen die Stereokonfiguration fix ist, so sollten nur einmal die Abbildungskarten berechnet werden; alle weiteren Bildpaare werden dann mit Hilfe des Operators map_imagemap_imageMapImageMapImageMapImagemap_image rektifiziert, was zum geringsten Rechenaufwand zur online Rektifizierung führt.

Bei der Verwendung der Abbildungskarten haben die transformierten Bilder dieselbe Größe wie die Karten. Jedes Pixel in der Karte enthält die Information, wie das neue Pixel an dieser Position generiert wird. Die Karten Map1Map1Map1Map1map1map_1, Map2Map2Map2Map2map2map_2 sind einkanalige Bilder, wenn MappingMappingMappingMappingmappingmapping auf 'nn_map'"nn_map""nn_map""nn_map""nn_map""nn_map" gesetzt ist, und bestehen aus fünf Kanälen, wenn 'bilinear_map'"bilinear_map""bilinear_map""bilinear_map""bilinear_map""bilinear_map" gewünscht wird. Im ersten Kanal, welcher vom Datentyp int4 ist, wird die lineare Koordinate des im Originalbild referenzierten Pixels gespeichert. Mit MappingMappingMappingMappingmappingmapping gleich 'nn_map'"nn_map""nn_map""nn_map""nn_map""nn_map" ist das referenzierte Pixel der nächste Nachbar des zurück transformierten Kartenpixels. Im Falle der bilinearen Interpolation ist das Referenzpixel die nächste obere, linke Ecke des zurück transformierten Pixels. Die folgende Abbildung zeigt die Ordnung der Pixel im Originalbild, welche den zurück transformierten Koordinaten am nächsten sind, wobei das Referenzpixel die Nummer zwei trägt:

2 3
4 5

Die Kanäle 2 bis 5, welche vom Datentyp uint2 sind, enthalten die Gewichte der entsprechenden Pixel für die bilineare Interpolation.

Für ein rektifiziertes Bildpaar kann die Disparität zwischen Bildpunkten oder Regionen mittels des Operators binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparitybinocular_disparity berechnet werden. Im Gegensatz zum Stereo bei voll kalibrierten Kameras mit der Rektifizierung mittels gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map kann bei schwach kalibrierten Kameras keine metrische Tiefeninformation abgeleitet werden. Die Disparität gibt dann lediglich eine qualitative Tiefenordnung der betrachteten Szene wieder.

Ausführungsinformationen

Parameter

Map1Map1Map1Map1map1map_1 (output_object)  image(-array) objectHImageHObjectHImageHobject * (int4 / uint2)

Bild, das die Rektifizierung des 1. Bildes codiert.

Map2Map2Map2Map2map2map_2 (output_object)  image(-array) objectHImageHObjectHImageHobject * (int4 / uint2)

Bild, das die Rektifizierung des 2. Bildes codiert.

FMatrixFMatrixFMatrixFMatrixFMatrixfmatrix (input_control)  hom_mat2d HHomMat2D, HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Fundamental-Matrix.

CovFMatCovFMatCovFMatCovFMatcovFMatcov_fmat (input_control)  number-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

9x9 Kovarianzmatrix der Fundamental-Matrix.

Defaultwert: []

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

Breite des 1. Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Restriktion: Width1 > 0

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

Höhe des 1. Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Restriktion: Height1 > 0

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

Breite des 2. Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Restriktion: Width2 > 0

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

Höhe des 2. Bildes.

Defaultwert: 512

Wertevorschläge: 128, 256, 512, 1024

Restriktion: Height2 > 0

SubSamplingSubSamplingSubSamplingSubSamplingsubSamplingsub_sampling (input_control)  number HTupleUnion[int, float]HTupleHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double)

Unterabtastfaktor.

Defaultwert: 1

Werteliste: 1, 2, 3, 1.5

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

Typ des Mappings.

Defaultwert: 'no_map' "no_map" "no_map" "no_map" "no_map" "no_map"

Werteliste: 'bilinear_map'"bilinear_map""bilinear_map""bilinear_map""bilinear_map""bilinear_map", 'nn_map'"nn_map""nn_map""nn_map""nn_map""nn_map", 'no_map'"no_map""no_map""no_map""no_map""no_map"

CovFMatRectCovFMatRectCovFMatRectCovFMatRectcovFMatRectcov_fmat_rect (output_control)  number-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

9x9 Kovarianzmatrix der rektifizierten Fundamental-Matrix.

H1H1H1H1h1h1 (output_control)  hom_mat2d HHomMat2D, HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Projektive Transformation des 1. Bildes.

H2H2H2H2h2h2 (output_control)  hom_mat2d HHomMat2D, HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Projektive Transformation des 2. Bildes.

Beispiel (HDevelop)

* Rectify an image pair using a map.
get_image_size (Image1, Width1, Height1)
get_image_size (Image2, Width2, Height2)
points_harris (Image1, 3, 1, 0.2, 10000, Row1, Col1)
points_harris (Image2, 3, 1, 0.2, 10000, Row2, Col2)
match_fundamental_matrix_ransac (Image1, Image2, Row1, Col1, Row2, Col2, \
                                 'ncc', 21, 0, 200, 20, 50, 0, 0.9, \
                                 'gold_standard', 0.3, 1, FMatrix, \
                                 CovFMat, Error, Points1, Points2)
gen_binocular_proj_rectification (Map1, Map2, FMatrix, [], Width1, \
                                  Height1, Width2, Height2, 1, \
                                  'bilinear_map', CovFMatRect, H1, H2)
map_image (Image1, Map1, Image1Rect)
map_image (Image2, Map2, Image2Rect)

* Rectify an image pair without using a map.
get_image_size (Image1, Width1, Height1)
get_image_size (Image2, Width2, Height2)
points_harris (Image1, 3, 1, 0.2, 10000, Row1, Col1)
points_harris (Image2, 3, 1, 0.2, 10000, Row2, Col2)
match_fundamental_matrix_ransac (Image1, Image2, Row1, Col1, Row2, Col2, \
                                 'ncc', 21, 0, 200, 20, 50, 0, 0.9, \
                                 'gold_standard', 0.3, 1, FMatrix, \
                                 CovFMat, Error, Points1, Points2)
gen_binocular_proj_rectification (Map1, Map2, FMatrix, [], Width1, \
                                  Height1, Width2, Height2, 1, \
                                  'no_map', CovFMatRect, H1, H2)
* Determine the maximum extent of the two rectified images.
projective_trans_point_2d (H1, [0,0,Height1,Height1], \
                           [0,Width1,0,Width1], [1,1,1,1], R1, C1, W1)
R1 := int(floor(R1/W1))
C1 := int(floor(C1/W1))
projective_trans_point_2d (H2, [0,0,Height2,Height2], \
                           [0,Width2,0,Width2], [1,1,1,1], R2, C2, W2)
R2 := int(floor(R2/W2))
C2 := int(floor(C2/W2))
WidthRect := max([C1,C2])
HeightRect := max([R1,R2])
projective_trans_image_size (Image1, Image1Rect, H1, 'bilinear', \
                             WidthRect, HeightRect, 'false')
projective_trans_image_size (Image2, Image2Rect, H2, 'bilinear', \
                             WidthRect, HeightRect, 'false')

Vorgänger

match_fundamental_matrix_ransacmatch_fundamental_matrix_ransacMatchFundamentalMatrixRansacMatchFundamentalMatrixRansacMatchFundamentalMatrixRansacmatch_fundamental_matrix_ransac, vector_to_fundamental_matrixvector_to_fundamental_matrixVectorToFundamentalMatrixVectorToFundamentalMatrixVectorToFundamentalMatrixvector_to_fundamental_matrix

Nachfolger

map_imagemap_imageMapImageMapImageMapImagemap_image, projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImageprojective_trans_image, binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparitybinocular_disparity

Alternativen

gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map

Literatur

J. Gluckmann and S.K. Nayar: „Rectifying transformations that minimize resampling effects“; IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2001, vol I, pages 111-117.

Modul

3D Metrology