gen_image_to_world_plane_mapT_gen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapgen_image_to_world_plane_map (Operator)

Name

gen_image_to_world_plane_mapT_gen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapgen_image_to_world_plane_map — Berechnen der Abbildung von der Bildebene in die Ebene z=0 eines Weltkoordinatensystems.

Signatur

gen_image_to_world_plane_map( : Map : CameraParam, WorldPose, WidthIn, HeightIn, WidthMapped, HeightMapped, Scale, MapType : )

Herror T_gen_image_to_world_plane_map(Hobject* Map, const Htuple CameraParam, const Htuple WorldPose, const Htuple WidthIn, const Htuple HeightIn, const Htuple WidthMapped, const Htuple HeightMapped, const Htuple Scale, const Htuple MapType)

void GenImageToWorldPlaneMap(HObject* Map, const HTuple& CameraParam, const HTuple& WorldPose, const HTuple& WidthIn, const HTuple& HeightIn, const HTuple& WidthMapped, const HTuple& HeightMapped, const HTuple& Scale, const HTuple& MapType)

void HImage::GenImageToWorldPlaneMap(const HCamPar& CameraParam, const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HTuple& Scale, const HString& MapType)

void HImage::GenImageToWorldPlaneMap(const HCamPar& CameraParam, const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HString& Scale, const HString& MapType)

void HImage::GenImageToWorldPlaneMap(const HCamPar& CameraParam, const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const char* Scale, const char* MapType)

void HImage::GenImageToWorldPlaneMap(const HCamPar& CameraParam, const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const wchar_t* Scale, const wchar_t* MapType)   (Nur Windows)

HImage HCamPar::GenImageToWorldPlaneMap(const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HTuple& Scale, const HString& MapType) const

HImage HCamPar::GenImageToWorldPlaneMap(const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HString& Scale, const HString& MapType) const

HImage HCamPar::GenImageToWorldPlaneMap(const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const char* Scale, const char* MapType) const

HImage HCamPar::GenImageToWorldPlaneMap(const HPose& WorldPose, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const wchar_t* Scale, const wchar_t* MapType) const   (Nur Windows)

HImage HPose::GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HTuple& Scale, const HString& MapType) const

HImage HPose::GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HString& Scale, const HString& MapType) const

HImage HPose::GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const char* Scale, const char* MapType) const

HImage HPose::GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const wchar_t* Scale, const wchar_t* MapType) const   (Nur Windows)

static void HOperatorSet.GenImageToWorldPlaneMap(out HObject map, HTuple cameraParam, HTuple worldPose, HTuple widthIn, HTuple heightIn, HTuple widthMapped, HTuple heightMapped, HTuple scale, HTuple mapType)

void HImage.GenImageToWorldPlaneMap(HCamPar cameraParam, HPose worldPose, int widthIn, int heightIn, int widthMapped, int heightMapped, HTuple scale, string mapType)

void HImage.GenImageToWorldPlaneMap(HCamPar cameraParam, HPose worldPose, int widthIn, int heightIn, int widthMapped, int heightMapped, string scale, string mapType)

HImage HCamPar.GenImageToWorldPlaneMap(HPose worldPose, int widthIn, int heightIn, int widthMapped, int heightMapped, HTuple scale, string mapType)

HImage HCamPar.GenImageToWorldPlaneMap(HPose worldPose, int widthIn, int heightIn, int widthMapped, int heightMapped, string scale, string mapType)

HImage HPose.GenImageToWorldPlaneMap(HCamPar cameraParam, int widthIn, int heightIn, int widthMapped, int heightMapped, HTuple scale, string mapType)

HImage HPose.GenImageToWorldPlaneMap(HCamPar cameraParam, int widthIn, int heightIn, int widthMapped, int heightMapped, string scale, string mapType)

def gen_image_to_world_plane_map(camera_param: Sequence[Union[int, float, str]], world_pose: Sequence[Union[int, float]], width_in: int, height_in: int, width_mapped: int, height_mapped: int, scale: Union[int, float, str], map_type: str) -> HObject

Beschreibung

gen_image_to_world_plane_mapgen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapGenImageToWorldPlaneMapgen_image_to_world_plane_map errechnet die Abbildung MapMapMapMapmapmap von der Bildebene in die Ebene z=0 (Messebene) eines Weltkoordinatensystems. Diese Abbildung kann z.B. dazu verwendet werden kann, ein Bild mit dem Operator map_imagemap_imageMapImageMapImageMapImagemap_image zu rektifizieren. Das rektifizierte Bild weist dann weder radiale noch perspektivische Verzerrungen auf; es entspricht einem Bild, das von einer verzerrungsfreien Kamera aufgenommen wird, die senkrecht auf die Messebene im Weltkoordinatensystem schaut. Das Weltkoordinatensystem (wcs) wird gewählt, indem man seine 3D-Lage in Kamerakoordinaten in WorldPoseWorldPoseWorldPoseWorldPoseworldPoseworld_pose übergibt. Diese 3D-Lage wird in der Form erwartet. Dabei steht ccs für das Kamerakoordinatensystem, siehe auch Transformationen / Posen und „Solution Guide III-C - 3D Vision“. In CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param müssen die internen Kameraparameter übergeben werden (siehe Kalibrierung für ihre Reihenfolge und das zu Grunde liegende Kameramodell).

In vielen Fällen sind CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param und WorldPoseWorldPoseWorldPoseWorldPoseworldPoseworld_pose das Ergebnis einer vorherigen Kamerakalibrierung mit dem Operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCamerascalibrate_cameras. Ein Beispiel findet sich weiter unten.

Die Größe der zu transformierenden Bilder kann mit WidthInWidthInWidthInWidthInwidthInwidth_in und HeightInHeightInHeightInHeightInheightInheight_in angegeben werden. Die Pixel-Position der linken oberen Ecke des Ergebnisbildes ist durch den Ursprung des Weltkoordinatensystems festgelegt. Die Ausdehnung des Ergebnisbildes kann durch die Parameter WidthMappedWidthMappedWidthMappedWidthMappedwidthMappedwidth_mapped, HeightMappedHeightMappedHeightMappedHeightMappedheightMappedheight_mapped und ScaleScaleScaleScalescalescale gewählt werden. Dabei sind WidthMappedWidthMappedWidthMappedWidthMappedwidthMappedwidth_mapped und HeightMappedHeightMappedHeightMappedHeightMappedheightMappedheight_mapped in Pixel anzugeben.

Der Parameter ScaleScaleScaleScalescalescale kann verwendet werden um die Größe eines Pixels im transformierten Bild festzulegen. Der Parameter kann auf zweit Arten verwendet werden:

Pixel auf metrische Einheiten skalieren:

Das Bild wird so skaliert, dass ein Pixel im transformierten Bild einer metrischen Einheit entspricht, z.B. legt das Setzen von 'mm'"mm""mm""mm""mm""mm" fest, dass ein Pixel im transformierten Bild der Fläche von 1mm x 1mm auf der Messebene entspricht. Damit dies möglich ist muss die ursprüngliche Einheit Meter sein. Dies ist der Fall wenn eine Standard-Kalibrierplatte verwendet wird.

Werteliste: 'm'"m""m""m""m""m", 'cm'"cm""cm""cm""cm""cm", 'mm'"mm""mm""mm""mm""mm", 'microns'"microns""microns""microns""microns""microns", 'um'"um""um""um""um""um".

Standardwert: 'm'"m""m""m""m""m".

Skalierung manuell steuern:

Die Skalierung des Bildes wird durch das Setzen einer Zahl gesteuert, die das Verhältnis Länge in ursprünglicher Einheit / gewünschte Anzahl Pixel bestimmt. Wenn beispielsweise die ursprüngliche Einheit Meter ist und jedes Pixel im transformierten Bild eine Fläche von 3mm x 3mm der Messebene darstellen soll, dann berechnet man die Skalierung . Für Aufgaben wie formbasiertes Matching auf dem transformierten Bild ist es sinnvoll das Bild so zu skalieren, dass der Inhalt in ähnlicher Größe wie im Originalbild dargestellt wird.

Restriktion: ScaleScaleScaleScalescalescale > 0.

Die Abbildungsvorschrift wird in dem Ausgabebild MapMapMapMapmapmap gespeichert. Dieses hat die gleiche Größe wie die Ergebnisbilder nach der Abbildung. Der Parameter MapTypeMapTypeMapTypeMapTypemapTypemap_type gibt an, in welchem Typ die Abbildungsvorschrift gespeichert werden soll. Wurde 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor" gewählt, so besteht MapMapMapMapmapmap aus einem Bild mit einem Kanal, in dem für jedes Pixel des Ergebnisbildes die linearen Koordinaten desjenigen Pixels des Eingabebildes stehen, welches den transformierten Koordinaten am nächsten liegt. Wurde die bilineare Interpolation ('bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear") gewählt, so besteht MapMapMapMapmapmap aus einem Bild mit fünf Kanälen. Der erste Kanal enthält für jedes Pixel des Ergebnisbildes die linearen Koordinaten desjenigen Pixels des Eingabebildes, welches links oberhalb von den transformierten Koordinaten liegt. Die übrigen vier Kanäle enthalten die Gewichte der einzelnen vier Nachbarpixel der transformierten Koordinaten für die bilineare Interpolation in folgender Reihenfolge:

2 3
4 5

Der zweite Kanal z.B. enthält die Gewichte der Pixel, die links oberhalb der transformierten Koordinaten liegen. Wurde 'coord_map_sub_pix'"coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix" gewählt, besteht MapMapMapMapmapmap aus einem Vektorfeld, welches für jedes Pixel des Ergebnisbildes die subpixelgenauen Koordinaten im Eingabebild enthält.

Sollen mehrere Bilder unter Verwendung derselben Parameter transformiert werden, so ist die Kombination aus gen_image_to_world_plane_mapgen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapGenImageToWorldPlaneMapgen_image_to_world_plane_map und map_imagemap_imageMapImageMapImageMapImagemap_image wesentlich effizienter als der Operator image_to_world_planeimage_to_world_planeImageToWorldPlaneImageToWorldPlaneImageToWorldPlaneimage_to_world_plane, da die Abbildungsvorschrift nur einmal berechnet werden muss.

Wenn die erzeugte Abbildung in einem anderen Programm wiederverwendet werden soll, kann man sie mit dem Operator write_imagewrite_imageWriteImageWriteImageWriteImagewrite_image als Mehrkanalbild abspeichern (Format: 'tiff'"tiff""tiff""tiff""tiff""tiff").

Ausführungsinformationen

Parameter

MapMapMapMapmapmap (output_object)  (multichannel-)image objectHImageHObjectHImageHobject * (int4 / int8 / uint2 / vector_field)

Bild mit den Abbildungsdaten.

CameraParamCameraParamCameraParamCameraParamcameraParamcamera_param (input_control)  campar HCamPar, HTupleSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)

Interne Kameraparameter.

WorldPoseWorldPoseWorldPoseWorldPoseworldPoseworld_pose (input_control)  pose HPose, HTupleSequence[Union[int, float]]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

3D-Lage des Weltkoordinatensystems in Kamerakoordinaten.

Parameteranzahl: 7

WidthInWidthInWidthInWidthInwidthInwidth_in (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite der zu transformierenden Bilder.

Restriktion: WidthIn >= 1

HeightInHeightInHeightInHeightInheightInheight_in (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe der zu transformierenden Bilder.

Restriktion: HeightIn >= 1

WidthMappedWidthMappedWidthMappedWidthMappedwidthMappedwidth_mapped (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite der Ergebnisbilder in Pixel.

Restriktion: WidthMapped >= 1

HeightMappedHeightMappedHeightMappedHeightMappedheightMappedheight_mapped (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe der Ergebnisbilder in Pixel.

Restriktion: HeightMapped >= 1

ScaleScaleScaleScalescalescale (input_control)  number HTupleUnion[int, float, str]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Maßstab oder Dimension.

Defaultwert: 'm' "m" "m" "m" "m" "m"

Wertevorschläge: 'm'"m""m""m""m""m", 'cm'"cm""cm""cm""cm""cm", 'mm'"mm""mm""mm""mm""mm", 'microns'"microns""microns""microns""microns""microns", 'um'"um""um""um""um""um", 1.0, 0.01, 0.001, 1.0e-6, 0.0254, 0.3048, 0.9144

Restriktion: Scale > 0

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

Typ der Abbildungsdaten.

Defaultwert: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear" "bilinear"

Werteliste: 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", 'coord_map_sub_pix'"coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix""coord_map_sub_pix", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor"

Beispiel (HDevelop)

* Calibrate camera.
calibrate_cameras (CalibDataID, Error)
* Obtain camera parameters.
get_calib_data (CalibDataID, 'camera', 0, 'params', CamParam)
* Example values, if no calibration data is available:
CamParam := ['area_scan_division', 0.0087, -1859, 8.65e-006, 8.6e-006, \
             362.5, 291.6, 768, 576]
* Get reference pose (pose 4 of calibration object 0).
get_calib_data (CalibDataID, 'calib_obj_pose',\
                [0,4], 'pose', Pose)
* Example values, if no calibration data is available:
Pose := [-0.11, -0.21, 2.51, 352.73, 346.73, 336.48, 0]
* Compensate thickness of plate.
set_origin_pose (Pose, -1.125, -1.0, 0, PoseNewOrigin)
* Transform the image into the world plane.
read_image (Image, 'calib/calib-3d-coord-04')
gen_image_to_world_plane_map (MapSingle, CamParam, PoseNewOrigin,\
                  CamParam[6], CamParam[7], 900, 800, 0.0025, 'bilinear')
map_image (Image, MapSingle, ImageMapped)

Ergebnis

Sind die Parameterwerte korrekt, dann liefert gen_image_to_world_plane_mapgen_image_to_world_plane_mapGenImageToWorldPlaneMapGenImageToWorldPlaneMapGenImageToWorldPlaneMapgen_image_to_world_plane_map den Wert TRUE.

Vorgänger

create_posecreate_poseCreatePoseCreatePoseCreatePosecreate_pose, hom_mat3d_to_posehom_mat3d_to_poseHomMat3dToPoseHomMat3dToPoseHomMat3dToPosehom_mat3d_to_pose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration, hand_eye_calibrationhand_eye_calibrationHandEyeCalibrationHandEyeCalibrationHandEyeCalibrationhand_eye_calibration, set_origin_poseset_origin_poseSetOriginPoseSetOriginPoseSetOriginPoseset_origin_pose

Nachfolger

map_imagemap_imageMapImageMapImageMapImagemap_image

Alternativen

image_to_world_planeimage_to_world_planeImageToWorldPlaneImageToWorldPlaneImageToWorldPlaneimage_to_world_plane

Siehe auch

map_imagemap_imageMapImageMapImageMapImagemap_image, contour_to_world_plane_xldcontour_to_world_plane_xldContourToWorldPlaneXldContourToWorldPlaneXldContourToWorldPlaneXldcontour_to_world_plane_xld, image_points_to_world_planeimage_points_to_world_planeImagePointsToWorldPlaneImagePointsToWorldPlaneImagePointsToWorldPlaneimage_points_to_world_plane

Modul

Calibration