【发布时间】:2017-08-19 12:25:39
【问题描述】:
如何在 Tensorflow 中将图像裁剪到边界框?我正在使用 Python API。
从文档中,
tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)
将图像裁剪到指定的边界框。
此操作从图像中切出一个矩形部分。返回的图片左上角在图片中的offset_height,offset_width,右下角在offset_height + target_height,offset_width + target_width。
我可以得到归一化坐标中边界框的坐标,
ymin = boxes[0,i,0]
xmin = boxes[0,i,1]
ymax = boxes[0,i,2]
xmax = boxes[0,i,3]
并将这些转换为绝对坐标,
(xminn, xmaxx, yminn, ymaxx) = (xmin * im_width, xmax * im_width, ymin * im_height, ymax * im_height)
但是我不知道如何在crop_to_bounding_box 函数中使用这些坐标。
【问题讨论】:
标签: tensorflow