天天看点

【Tensorflow】(四):tf.image.draw_bounding_boxes

tf.image.draw_bounding_boxes(

    images,

    boxes,

    name=None

)

定义于:tensorflow/python/ops/gen_image_ops.py。

在一批图像上绘制边界框。

输出副本,images但在像素之上绘制由位置指定的零个或多个边界框boxes。每个边界框的坐标boxes编码为[y_min, x_min, y_max, x_max]。边界框坐标是[0.0, 1.0]相对于底层图像的宽度和高度的浮动。

边界框的部分可能落在图像之外。

参数:

images:A Tensor。必须是以下类型之一:float32, half。4-D,形状[batch, height, width, depth]。一批图片。

boxes:类型为float32的Tensor。3-D, 形状[batch, num_bounding_boxes, 4]包含边界框。

name:操作的名称(可选)。

返回:

Tensor:和images一样的类型。

image_with_box = tf.image.draw_bounding_boxes(tf.expand_dims(image, 0),bbox)
           

继续阅读