将像素坐标转换为offset_height offset_width

时间:2017-12-15 17:27:28

标签: css image-processing tensorflow

我正在尝试使用

裁剪图像
 tf.image.crop_to_bounding_box(image,
offset_height,
offset_width,
target_height,
target_width)

在tensorflow中的功能。我将像素坐标裁剪为x1,y1,x2,y2。如何将此坐标转换为offset_height,offset_width,target_height,target_width

1 个答案:

答案 0 :(得分:0)

我想,您想要从点转换为长度?

offset_height = y1; //y1 - 0
offset_width = x1; //x1 - 0
target_height = y2 - y1;
target_width = x2 - x1;