bundle_adjust_mosaicT_bundle_adjust_mosaicBundleAdjustMosaicBundleAdjustMosaicbundle_adjust_mosaic捆绑调整拼接(算子)

名称

bundle_adjust_mosaicT_bundle_adjust_mosaicBundleAdjustMosaicBundleAdjustMosaicbundle_adjust_mosaic — 对图像拼接进行捆绑调整。

签名

bundle_adjust_mosaic( : : NumImages, ReferenceImage, MappingSource, MappingDest, HomMatrices2D, Rows1, Cols1, Rows2, Cols2, NumCorrespondences, Transformation : MosaicMatrices2D, Rows, Cols, Error)

Herror T_bundle_adjust_mosaic(const Htuple NumImages, const Htuple ReferenceImage, const Htuple MappingSource, const Htuple MappingDest, const Htuple HomMatrices2D, const Htuple Rows1, const Htuple Cols1, const Htuple Rows2, const Htuple Cols2, const Htuple NumCorrespondences, const Htuple Transformation, Htuple* MosaicMatrices2D, Htuple* Rows, Htuple* Cols, Htuple* Error)

void BundleAdjustMosaic(const HTuple& NumImages, const HTuple& ReferenceImage, const HTuple& MappingSource, const HTuple& MappingDest, const HTuple& HomMatrices2D, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& NumCorrespondences, const HTuple& Transformation, HTuple* MosaicMatrices2D, HTuple* Rows, HTuple* Cols, HTuple* Error)

static HHomMat2DArray HHomMat2D::BundleAdjustMosaic(Hlong NumImages, Hlong ReferenceImage, const HTuple& MappingSource, const HTuple& MappingDest, const HHomMat2DArray& HomMatrices2D, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& NumCorrespondences, const HString& Transformation, HTuple* Rows, HTuple* Cols, HTuple* Error)

static HHomMat2DArray HHomMat2D::BundleAdjustMosaic(Hlong NumImages, Hlong ReferenceImage, const HTuple& MappingSource, const HTuple& MappingDest, const HHomMat2DArray& HomMatrices2D, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& NumCorrespondences, const HString& Transformation, HTuple* Rows, HTuple* Cols, double* Error)

static HHomMat2DArray HHomMat2D::BundleAdjustMosaic(Hlong NumImages, Hlong ReferenceImage, const HTuple& MappingSource, const HTuple& MappingDest, const HHomMat2DArray& HomMatrices2D, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& NumCorrespondences, const char* Transformation, HTuple* Rows, HTuple* Cols, double* Error)

static HHomMat2DArray HHomMat2D::BundleAdjustMosaic(Hlong NumImages, Hlong ReferenceImage, const HTuple& MappingSource, const HTuple& MappingDest, const HHomMat2DArray& HomMatrices2D, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& NumCorrespondences, const wchar_t* Transformation, HTuple* Rows, HTuple* Cols, double* Error)   ( Windows only)

static void HOperatorSet.BundleAdjustMosaic(HTuple numImages, HTuple referenceImage, HTuple mappingSource, HTuple mappingDest, HTuple homMatrices2D, HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple numCorrespondences, HTuple transformation, out HTuple mosaicMatrices2D, out HTuple rows, out HTuple cols, out HTuple error)

static HHomMat2D[] HHomMat2D.BundleAdjustMosaic(int numImages, int referenceImage, HTuple mappingSource, HTuple mappingDest, HHomMat2D[] homMatrices2D, HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple numCorrespondences, string transformation, out HTuple rows, out HTuple cols, out HTuple error)

static HHomMat2D[] HHomMat2D.BundleAdjustMosaic(int numImages, int referenceImage, HTuple mappingSource, HTuple mappingDest, HHomMat2D[] homMatrices2D, HTuple rows1, HTuple cols1, HTuple rows2, HTuple cols2, HTuple numCorrespondences, string transformation, out HTuple rows, out HTuple cols, out double error)

def bundle_adjust_mosaic(num_images: int, reference_image: int, mapping_source: Sequence[int], mapping_dest: Sequence[int], hom_matrices_2d: Sequence[float], rows_1: Sequence[Union[float, int]], cols_1: Sequence[Union[float, int]], rows_2: Sequence[Union[float, int]], cols_2: Sequence[Union[float, int]], num_correspondences: Sequence[int], transformation: str) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def bundle_adjust_mosaic_s(num_images: int, reference_image: int, mapping_source: Sequence[int], mapping_dest: Sequence[int], hom_matrices_2d: Sequence[float], rows_1: Sequence[Union[float, int]], cols_1: Sequence[Union[float, int]], rows_2: Sequence[Union[float, int]], cols_2: Sequence[Union[float, int]], num_correspondences: Sequence[int], transformation: str) -> Tuple[Sequence[float], Sequence[float], Sequence[float], float]

描述

bundle_adjust_mosaicbundle_adjust_mosaicBundleAdjustMosaicBundleAdjustMosaicBundleAdjustMosaicbundle_adjust_mosaic 对图像拼接执行捆绑调整。该方法可尽可能稳健地确定拼接的几何结构,从而比单张图像对更精确地确定拼接中各图像的变换关系。

要实现这一目标,应使用 proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansacProjMatchPointsRansacproj_match_points_ransac 算法确定拼接中每对重叠图像的投影变换。例如,对于如下布局的2×2图像块:

1 2
3 4

假设所有图像相互重叠,需确定以下投影变换: 1->2、1->3、1->4、2->3、2->4 和 3->4。确定相应变换的图像索引由映射源( MappingSourceMappingSourceMappingSourceMappingSourcemappingSourcemapping_source)和映射目标(MappingDestMappingDestMappingDestMappingDestmappingDestmapping_dest)给出。索引从 1 开始计数。因此,在上述示例中必须使用 MappingSourceMappingSourceMappingSourceMappingSourcemappingSourcemapping_source = [1,1,1,2,2,3]MappingDestMappingDestMappingDestMappingDestmappingDestmapping_dest = [2,3,4,3,4,4]。拼接中的图像数量由 NumImagesNumImagesNumImagesNumImagesnumImagesnum_images 决定,用于验证每张图像能否通过连续变换链抵达。参考图像索引由 ReferenceImageReferenceImageReferenceImageReferenceImagereferenceImagereference_image 指定,输出时该图像的变换矩阵为单位矩阵。

对应图像对的 3×3 投影变换矩阵通过 HomMatrices2DHomMatrices2DHomMatrices2DHomMatrices2DhomMatrices2Dhom_matrices_2d 传递。此外,图像对中匹配点对的坐标必须通过 Rows1Rows1Rows1Rows1rows1rows_1Cols1Cols1Cols1Cols1cols1cols_1Rows2Rows2Rows2Rows2rows2rows_2Cols2Cols2Cols2Cols2cols2cols_2 传递。这些坐标可通过 proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansacProjMatchPointsRansacproj_match_points_ransac 的输出结合 tuple_selecttuple_selectTupleSelectTupleSelectTupleSelecttuple_select 或HDevelop函数 subset 功能确定。为使 bundle_adjust_mosaicbundle_adjust_mosaicBundleAdjustMosaicBundleAdjustMosaicBundleAdjustMosaicbundle_adjust_mosaic 能确定点对所属图像对,NumCorrespondencesNumCorrespondencesNumCorrespondencesNumCorrespondencesnumCorrespondencesnum_correspondences 必须包含每组图像对中找到的点匹配数量。

参数 TransformationTransformationTransformationTransformationtransformationtransformation 决定了捆绑调整中用于变换图像点的变换类别。此参数可用于限制允许的变换类别。当 TransformationTransformationTransformationTransformationtransformationtransformation = 'projective'"projective""projective""projective""projective""projective" 时,使用投影变换(参见 vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2dVectorToProjHomMat2dvector_to_proj_hom_mat2d)。当 TransformationTransformationTransformationTransformationtransformationtransformation = 'affine'"affine""affine""affine""affine""affine" 时,使用仿射变换(参见 vector_to_hom_mat2dvector_to_hom_mat2dVectorToHomMat2dVectorToHomMat2dVectorToHomMat2dvector_to_hom_mat2d);当 TransformationTransformationTransformationTransformationtransformationtransformation = 'similarity'"similarity""similarity""similarity""similarity""similarity" 时,使用相似变换(参见 vector_to_similarityvector_to_similarityVectorToSimilarityVectorToSimilarityVectorToSimilarityvector_to_similarity);当 TransformationTransformationTransformationTransformationtransformationtransformation = 'rigid'"rigid""rigid""rigid""rigid""rigid" 时,使用刚体变换(参见 vector_to_rigidvector_to_rigidVectorToRigidVectorToRigidVectorToRigidvector_to_rigid)。

捆绑调整后的变换结果以 3×3 投影变换矩阵数组的形式存储于 MosaicMatrices2DMosaicMatrices2DMosaicMatrices2DMosaicMatrices2DmosaicMatrices2Dmosaic_matrices_2d 中。此外,捆绑调整重建的点存储于(RowsRowsRowsRowsrowsrows, ColsColsColsColscolscols)中。重建点的平均投影误差存储于 ErrorErrorErrorErrorerrorerror 中,可用于验证优化是否收敛至有效值。

执行信息

参数

NumImagesNumImagesNumImagesNumImagesnumImagesnum_images (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

用于标定的不同图像数量。

限制: NumImages >= 2

ReferenceImageReferenceImageReferenceImageReferenceImagereferenceImagereference_image (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

参考图像索引。

MappingSourceMappingSourceMappingSourceMappingSourcemappingSourcemapping_source (输入控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

变换源图像的索引。

MappingDestMappingDestMappingDestMappingDestmappingDestmapping_dest (输入控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

变换后目标图像的索引。

HomMatrices2DHomMatrices2DHomMatrices2DHomMatrices2DhomMatrices2Dhom_matrices_2d (输入控制)  hom_mat2d-array HHomMat2D, HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

3×3 投影变换矩阵数组。

Rows1Rows1Rows1Rows1rows1rows_1 (输入控制)  point.x-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

各源图像中对应点的行坐标。

Cols1Cols1Cols1Cols1cols1cols_1 (输入控制)  point.y-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

各源图像中对应点的列坐标。

Rows2Rows2Rows2Rows2rows2rows_2 (输入控制)  point.x-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

各目标图像中对应点的行坐标。

Cols2Cols2Cols2Cols2cols2cols_2 (输入控制)  point.y-array HTupleSequence[Union[float, int]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

各目标图像中对应点的列坐标。

NumCorrespondencesNumCorrespondencesNumCorrespondencesNumCorrespondencesnumCorrespondencesnum_correspondences (输入控制)  integer-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

各图像对中对应点的数量。

TransformationTransformationTransformationTransformationtransformationtransformation (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

要使用的变换类别。

默认值: 'projective' "projective" "projective" "projective" "projective" "projective"

值列表: 'affine'"affine""affine""affine""affine""affine", 'projective'"projective""projective""projective""projective""projective", 'rigid'"rigid""rigid""rigid""rigid""rigid", 'similarity'"similarity""similarity""similarity""similarity""similarity"

MosaicMatrices2DMosaicMatrices2DMosaicMatrices2DMosaicMatrices2DmosaicMatrices2Dmosaic_matrices_2d (输出控制)  hom_mat2d-array HHomMat2D, HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

由 3×3 投影变换矩阵组成的数组,用于确定拼接中图像的位置。

RowsRowsRowsRowsrowsrows (输出控制)  point.x-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

捆绑调整重建点的行坐标。

ColsColsColsColscolscols (输出控制)  point.y-array HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

捆绑调整重建点的列坐标。

ErrorErrorErrorErrorerrorerror (输出控制)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

每个重建点的平均误差。

示例(HDevelop)

* Assume that Images contains the four images of the mosaic in the
* layout given in the above description.  Then the following example
* computes the bundle-adjusted transformation matrices.
From := [1,1,1,2,2,3]
To := [2,3,4,3,4,4]
HomMatrices2D := []
Rows1 := []
Cols1 := []
Rows2 := []
Cols2 := []
NumMatches := []
for J := 0 to |From|-1 by 1
    select_obj (Images, ImageF, From[J])
    select_obj (Images, ImageT, To[J])
    points_foerstner (ImageF, 1, 2, 3, 100, 0.1, 'gauss', 'true', \
                      RowsF, ColsF, _, _, _, _, _, _, _, _)
    points_foerstner (ImageT, 1, 2, 3, 100, 0.1, 'gauss', 'true', \
                      RowsT, ColsT, _, _, _, _, _, _, _, _)
    proj_match_points_ransac (ImageF, ImageT, RowsF, ColsF, RowsT, ColsT, \
                              'ncc', 10, 0, 0, 480, 640, 0, 0.5, \
                              'gold_standard', 2, 42, HomMat2D, \
                              Points1, Points2)
    HomMatrices2D := [HomMatrices2D,HomMat2D]
    Rows1 := [Rows1,subset(RowsF,Points1)]
    Cols1 := [Cols1,subset(ColsF,Points1)]
    Rows2 := [Rows2,subset(RowsT,Points2)]
    Cols2 := [Cols2,subset(ColsT,Points2)]
    NumMatches := [NumMatches,|Points1|]
endfor
bundle_adjust_mosaic (4, 1, From, To, HomMatrices2D, Rows1, Cols1, \
                      Rows2, Cols2, NumMatches, 'rigid', MosaicMatrices, \
                      Rows, Columns, Error)
gen_bundle_adjusted_mosaic (Images, MosaicImage, HomMatrices2D, \
                            'default', 'false', TransMat2D)

结果

如果参数有效,算子 bundle_adjust_mosaicbundle_adjust_mosaicBundleAdjustMosaicBundleAdjustMosaicBundleAdjustMosaicbundle_adjust_mosaic 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansacProjMatchPointsRansacproj_match_points_ransac, proj_match_points_ransac_guidedproj_match_points_ransac_guidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuidedproj_match_points_ransac_guided

可能的后继

gen_bundle_adjusted_mosaicgen_bundle_adjusted_mosaicGenBundleAdjustedMosaicGenBundleAdjustedMosaicGenBundleAdjustedMosaicgen_bundle_adjusted_mosaic

另见

gen_projective_mosaicgen_projective_mosaicGenProjectiveMosaicGenProjectiveMosaicGenProjectiveMosaicgen_projective_mosaic

模块

匹配