Skip to content

gen_spherical_mosaicgen_spherical_mosaicGenSphericalMosaicGenSphericalMosaicgen_spherical_mosaicT_gen_spherical_mosaicπŸ”—

Short descriptionπŸ”—

gen_spherical_mosaicgen_spherical_mosaicGenSphericalMosaicGenSphericalMosaicgen_spherical_mosaicT_gen_spherical_mosaic β€” Create a spherical mosaic image.

SignatureπŸ”—

gen_spherical_mosaic( image Images, out image MosaicImage, hom_mat2d CameraMatrices, hom_mat2d RotationMatrices, angle.deg LatMin, angle.deg LatMax, angle.deg LongMin, angle.deg LongMax, angle.deg LatLongStep, string StackingOrder, string Interpolation )gen_spherical_mosaic( Images : MosaicImage : CameraMatrices, RotationMatrices, LatMin, LatMax, LongMin, LongMax, LatLongStep, StackingOrder, Interpolation : )void GenSphericalMosaic( const HObject& Images, HObject* MosaicImage, const HTuple& CameraMatrices, const HTuple& RotationMatrices, const HTuple& LatMin, const HTuple& LatMax, const HTuple& LongMin, const HTuple& LongMax, const HTuple& LatLongStep, const HTuple& StackingOrder, const HTuple& Interpolation )static void HOperatorSet.GenSphericalMosaic( HObject images, out HObject mosaicImage, HTuple cameraMatrices, HTuple rotationMatrices, HTuple latMin, HTuple latMax, HTuple longMin, HTuple longMax, HTuple latLongStep, HTuple stackingOrder, HTuple interpolation )def gen_spherical_mosaic( images: HObject, camera_matrices: Sequence[float], rotation_matrices: Sequence[float], lat_min: Union[float, int], lat_max: Union[float, int], long_min: Union[float, int], long_max: Union[float, int], lat_long_step: Union[float, int], stacking_order: MaybeSequence[Union[str, int]], interpolation: Union[str, int] ) -> HObject

Herror T_gen_spherical_mosaic( const Hobject Images, Hobject* MosaicImage, const Htuple CameraMatrices, const Htuple RotationMatrices, const Htuple LatMin, const Htuple LatMax, const Htuple LongMin, const Htuple LongMax, const Htuple LatLongStep, const Htuple StackingOrder, const Htuple Interpolation )

HImage HImage::GenSphericalMosaic( const HHomMat2DArray& CameraMatrices, const HHomMat2DArray& RotationMatrices, const HTuple& LatMin, const HTuple& LatMax, const HTuple& LongMin, const HTuple& LongMax, const HTuple& LatLongStep, const HTuple& StackingOrder, const HTuple& Interpolation ) const

HImage HImage::GenSphericalMosaic( const HHomMat2DArray& CameraMatrices, const HHomMat2DArray& RotationMatrices, double LatMin, double LatMax, double LongMin, double LongMax, double LatLongStep, const HString& StackingOrder, const HString& Interpolation ) const

HImage HImage::GenSphericalMosaic( const HHomMat2DArray& CameraMatrices, const HHomMat2DArray& RotationMatrices, double LatMin, double LatMax, double LongMin, double LongMax, double LatLongStep, const char* StackingOrder, const char* Interpolation ) const

HImage HImage::GenSphericalMosaic( const HHomMat2DArray& CameraMatrices, const HHomMat2DArray& RotationMatrices, double LatMin, double LatMax, double LongMin, double LongMax, double LatLongStep, const wchar_t* StackingOrder, const wchar_t* Interpolation ) const (Windows only)

HImage HImage.GenSphericalMosaic( HHomMat2D[] cameraMatrices, HHomMat2D[] rotationMatrices, HTuple latMin, HTuple latMax, HTuple longMin, HTuple longMax, HTuple latLongStep, HTuple stackingOrder, HTuple interpolation )

HImage HImage.GenSphericalMosaic( HHomMat2D[] cameraMatrices, HHomMat2D[] rotationMatrices, double latMin, double latMax, double longMin, double longMax, double latLongStep, string stackingOrder, string interpolation )

DescriptionπŸ”—

gen_spherical_mosaicGenSphericalMosaic creates a spherical mosaic image MosaicImagemosaicImagemosaic_image from the input images passed in Imagesimagesimages. The pose of the images in space, which is used to compute the position of the images with respect to the surface of the sphere, can be determined with stationary_camera_self_calibrationStationaryCameraSelfCalibration. The camera and rotation matrices computed with stationary_camera_self_calibrationStationaryCameraSelfCalibration can be used in CameraMatricescameraMatricescamera_matrices and RotationMatricesrotationMatricesrotation_matrices. A spherical mosaic can only be created from images that were taken with a stationary camera (see stationary_camera_self_calibrationStationaryCameraSelfCalibration).

The mosaic is computed in spherical coordinates (longitude and latitude). The row axis of MosaicImagemosaicImagemosaic_image corresponds to the latitude, while the column axis corresponds to the longitude. The part of the sphere that is computed by gen_spherical_mosaicGenSphericalMosaic is determined by LatMinlatMinlat_min, LatMaxlatMaxlat_max, LongMinlongMinlong_min, and LongMaxlongMaxlong_max. These parameters are specified in degrees and determine a rectangular part of the latitude and longitude coordinates. The latitude -90-90 corresponds to the north pole (i.e., the straight up viewing direction), while 9090 corresponds to the south pole (i.e., the straight down viewing direction). The longitude 00 corresponds to the straight ahead viewing direction. Negative longitudes correspond to viewing directions to the left, while positive longitudes correspond to viewing directions to the right. Hence, to obtain a complete image of the sphere, LatMinlatMinlat_min \(=\) -90-90, LatMaxlatMaxlat_max \(=\) 9090, LongMinlongMinlong_min \(=\) -180-180, and LongMaxlongMaxlong_max \(=\) 180180 must be used. In many cases, the mosaic will not cover the entire sphere. In these cases, it is useful to select the desired part of the sphere with the above parameters. This can be done by explicitly specifying the desired rectangle. However, often it is desirable to determine the smallest rectangle that encloses all images automatically. This can be done by using LatMinlatMinlat_min \(<\) -90-90, LatMaxlatMaxlat_max \(>\) 9090, LongMinlongMinlong_min \(<\) -180-180, and LongMaxlongMaxlong_max \(>\) 180180. Only the parameters that lie outside the normal range of values are determined automatically.

The angle step per pixel in MosaicImagemosaicImagemosaic_image can be selected with LatLongSteplatLongSteplat_long_step, which also is an angle specified in degrees. With this, the resolution of the mosaic image can be controlled. If LatLongSteplatLongSteplat_long_step is set to 00 the angle step is calculated automatically by trying to preserve the pixel size of the original images as well as possible.

The mode in which the images are added to the mosaic is given by StackingOrderstackingOrderstacking_order. For \(\textrm{StackingOrder} = '\textit{voronoi}'\), the points in the mosaic image are determined from the Voronoi cell of the respective input image. This means that the gray values are taken from the points of the input image to whose center the pixel in the mosaic image has the smallest distance on the sphere. This mode has the advantage that vignetting and uncorrected radial distortions are less noticeable in the mosaic image because they typically are symmetric with respect to the image center. Alternatively, with the choice of parameters described described in the following, a mode can be selected that has the same effect as if the images were painted successively into the mosaic image. Here, the order in which the images are added to the mosaic image is important. Therefore, an array of integer values can be passed in StackingOrderstackingOrderstacking_order. The first index in this array will end up at the bottom of the image stack while the last one will be on top. If 'default'"default" is given instead of an array of integers, the canonical order (images in the order used in Imagesimagesimages) will be used. Hence, if neither 'voronoi'"voronoi" nor 'default'"default" are used, StackingOrderstackingOrderstacking_order must contain a permutation of the numbers 1,…,\(n\), where \(n\) is the number of images passed in Imagesimagesimages. It should be noted that the mode 'voronoi'"voronoi" cannot always be used. For example, at least two images must be passed to use this mode. Furthermore, for very special configurations of the positions of the image centers on the sphere, the Voronoi cells cannot be determined uniquely. With \(\textrm{StackingOrder} = '\textit{blend}'\), an additional mode is available, which blends the images of the mosaic smoothly. This way seams between the images become less apparent. The seam lines between the images are the same as in 'voronoi'"voronoi". This mode leads to visually more appealing images, but requires significantly more resources. If the mode 'voronoi'"voronoi" or 'blend'"blend" cannot be used for whatever reason the mode is switched internally to 'default'"default" automatically.

The parameter Interpolationinterpolationinterpolation selects the desired interpolation mode for creating the mosaic. 'bilinear'"bilinear" and 'bicubic'"bicubic" interpolation is available for all modes of StackingOrderstackingOrderstacking_order. 'nearest_neighbor'"nearest_neighbor" is only available if StackingOrderstackingOrderstacking_order is set to 'default'"default" or 'voronoi'"voronoi".

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Imagesimagesimages (input_object) (multichannel-)image-array β†’ object (byte / uint2 / real)object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

Input images.

MosaicImagemosaicImagemosaic_image (output_object) (multichannel-)image β†’ object (byte / uint2 / real)object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject * (byte / uint2 / real)

Output image.

CameraMatricescameraMatricescamera_matrices (input_control) hom_mat2d-array β†’ (real)(real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)

(Array of) 3x3 projective camera matrices that determine the internal camera parameters.

RotationMatricesrotationMatricesrotation_matrices (input_control) hom_mat2d-array β†’ (real)(real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)

Array of 3x3 transformation matrices that determine rotation of the camera in the respective image.

LatMinlatMinlat_min (input_control) angle.deg β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum latitude of points in the spherical mosaic image.

Default: -90-90
Suggested values: -100, -90, -80, -70, -60, -50, -40, -30, -20, -10-100, -90, -80, -70, -60, -50, -40, -30, -20, -10
Restriction: LatMin <= 90

LatMaxlatMaxlat_max (input_control) angle.deg β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum latitude of points in the spherical mosaic image.

Default: 9090
Suggested values: 10, 20, 30, 40, 50, 60, 70, 80, 90, 10010, 20, 30, 40, 50, 60, 70, 80, 90, 100
Restriction: LatMax >= -90 && LatMax > LatMin

LongMinlongMinlong_min (input_control) angle.deg β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Minimum longitude of points in the spherical mosaic image.

Default: -180-180
Suggested values: -200, -180, -160, -140, -120, -100, -90, -80, -70, -60, -50, -40, -30, -20, -10-200, -180, -160, -140, -120, -100, -90, -80, -70, -60, -50, -40, -30, -20, -10
Restriction: LongMin <= 180

LongMaxlongMaxlong_max (input_control) angle.deg β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Maximum longitude of points in the spherical mosaic image.

Default: 180180
Suggested values: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 20010, 20, 30, 40, 50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200
Restriction: LongMax >= -90 && LongMax > LongMin

LatLongSteplatLongSteplat_long_step (input_control) angle.deg β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)

Latitude and longitude angle step width.

Default: 0.10.1
Suggested values: 0, 0.02, 0.05, 0.1, 0.2, 0.5, 10, 0.02, 0.05, 0.1, 0.2, 0.5, 1
Restriction: LatLongStep >= 0

StackingOrderstackingOrderstacking_order (input_control) string(-array) β†’ (string / integer)(string / integer)HTuple (HString / Hlong)HTuple (string / int / long)MaybeSequence[Union[str, int]]Htuple (char* / Hlong)

Mode of adding the images to the mosaic image.

Default: 'voronoi'"voronoi"
Suggested values: 'blend', 'voronoi', 'default'"blend", "voronoi", "default"

Interpolationinterpolationinterpolation (input_control) string β†’ (string / integer)(string / integer)HTuple (HString / Hlong)HTuple (string / int / long)Union[str, int]Htuple (char* / Hlong)

Mode of interpolation when creating the mosaic image.

Default: 'bilinear'"bilinear"
Suggested values: 'nearest_neighbor', 'bilinear', 'bicubic'"nearest_neighbor", "bilinear", "bicubic"

ExampleπŸ”—

(HDevelop)


* For the input data to stationary_camera_self_calibration, please
* refer to the example for stationary_camera_self_calibration.
stationary_camera_self_calibration (4, 640, 480, 1, From, To, \
                                    HomMatrices2D, Rows1, Cols1, \
                                    Rows2, Cols2, NumMatches, \
                                    'gold_standard', \
                                    ['focus','principal_point'], \
                                    'true', CameraMatrix, Kappa, \
                                    RotationMatrices, X, Y, Z, Error)
gen_spherical_mosaic (Images, MosaicImage, CameraMatrix, \
                      RotationMatrices, -100, 100, -200, 200, 0, \
                      'default','bilinear')

* Alternatively, if kappa should be determined, the following calls
* can be made:
stationary_camera_self_calibration (4, 640, 480, 1, From, To, \
                                    HomMatrices2D, Rows1, Cols1, \
                                    Rows2, Cols2, NumMatches, \
                                    'gold_standard', \
                                    ['focus','principal_point','kappa'], \
                                    'true', CameraMatrix, Kappa, \
                                    RotationMatrices, X, Y, Z, Error)
cam_mat_to_cam_par (CameraMatrix, Kappa, 640, 480, CamParam)
change_radial_distortion_cam_par ('fixed', CamParam, 0, CamParOut)
gen_radial_distortion_map (Map, CamParam, CamParOut, 'bilinear')
map_image (Images, Map, ImagesRect)
gen_spherical_mosaic (ImagesRect, MosaicImage, CameraMatrix, \
                      RotationMatrices, -100, 100, -200, 200, 0, \
                      'default','bilinear')

ResultπŸ”—

If the parameters are valid, the operator gen_spherical_mosaicGenSphericalMosaic returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

stationary_camera_self_calibrationStationaryCameraSelfCalibration

Alternatives

gen_cube_map_mosaicGenCubeMapMosaic, gen_projective_mosaicGenProjectiveMosaic

ReferencesπŸ”—

Lourdes Agapito, E. Hayman, I. Reid: ``Self-Calibration of Rotating and Zooming Camerasβ€™β€˜; International Journal of Computer Vision; vol. 45, no. 2; pp. 107–127; 2001.

Olivier Faugeras, Quang-Tuan Luong: ``The Geometry of Multiple Images: The Laws That Govern the Formation of Multiple Images of a Scene and Some of Their Applicationsβ€™β€˜; MIT Press, Cambridge, MA; 2001.

ModuleπŸ”—

Matching