procedure parameters_image_to_world_plane_centered (: : CamParam, Pose,CenterRow, CenterCol,WidthMappedImage,HeightMappedImage:ScaleForCenteredImage,PoseForCenteredImage)
* Determine the scale for the mapping
* (here, the scale is determined such that in the
* surroundings of the given point the image scale of the
* mapped image is similar to the image scale of the original image)
Dist_ICS := 1
image_points_to_world_plane (CamParam, Pose, CenterRow, CenterCol, 1, \
CenterX, CenterY)
image_points_to_world_plane (CamParam, Pose, CenterRow + Dist_ICS, \
CenterCol, 1, BelowCenterX, BelowCenterY)
image_points_to_world_plane (CamParam, Pose, CenterRow, \
CenterCol + Dist_ICS, 1, RightOfCenterX, \
RightOfCenterY)
distance_pp (CenterY, CenterX, BelowCenterY, BelowCenterX, \
Dist_WCS_Vertical)
distance_pp (CenterY, CenterX, RightOfCenterY, RightOfCenterX, \
Dist_WCS_Horizontal)
ScaleVertical := Dist_WCS_Vertical / Dist_ICS
ScaleHorizontal := Dist_WCS_Horizontal / Dist_ICS
ScaleForCenteredImage := (ScaleVertical + ScaleHorizontal) / 2.0
* Determine the parameters for set_origin_pose such
* that the point given via get_mbutton will be in the center of the
* mapped image
DX := CenterX - ScaleForCenteredImage * WidthMappedImage / 2.0
DY := CenterY - ScaleForCenteredImage * HeightMappedImage / 2.0
DZ := 0
set_origin_pose (Pose, DX, DY, DZ, PoseForCenteredImage)
return()
* Transform the image border into the WCS (scale = 1)
full_domain (Image, ImageFull)
get_domain (ImageFull, Domain)
gen_contour_region_xld (Domain, ImageBorder, 'border')
contour_to_world_plane_xld (ImageBorder, ImageBorderWCS, CamParam, Pose, 1)
smallest_rectangle1_xld (ImageBorderWCS, MinY, MinX, MaxY, MaxX)
* Determine the scale of the mapping
ExtentX := MaxX - MinX
ExtentY := MaxY - MinY
ScaleX := ExtentX / WidthMappedImage
ScaleY := ExtentY / HeightMappedImage
ScaleForEntireImage := max([ScaleX,ScaleY])
* Shift the pose by the minimum X and Y coordinates
set_origin_pose (Pose, MinX, MinY, 0, PoseForEntireImage)
return ()