方法:仿射变换
因为 Crop_domain操作只是水平移动不涉及旋转,移动距离和方向不要搞错,应该是原始图片上被crop掉区域的中心点减去crop图的中心点;
1)区域或者坐标:
*****通过反射变换也可以实现复原原始坐标
area_center (ImageCrop, Area3, Row1, Column1);
hv_PosMidRow, hv_PosMidCol 为原图中需要ImageCrop图像的中心位置;
vector_angle_to_rigid (Row1, Column1, 0, hv_PosMidRow, hv_PosMidCol , 0, HomMat2D)
affine_trans_region (ObjectSelected1, RegionAffineTrans, HomMat2D, 'nearest_neighbor')
area_center (RegionAffineTrans, Area4, Row2, Column2)
或
affine_trans_pixel (HomMat2D, hv_CircleRow, hv_CircleColumn, Row3, Column3)
2)若果是图像的话,affine_trans_image (ImageIn, ImageAffineTrans, HomMat2DTranslate, ‘constant’, ‘true’)仿射变换图像中的最后一个参数AdaptImageSize一定要设置成true,要不然仿射后的图像超出区域都将被剪切成0,无法做paint操作;
paint_gray时操作是crop图贴到原始图片上,反的话将没有效果。