TensorFlow从图像提取区域的函数
来源:互联网 发布:人工智能行业入门 编辑:程序博客网 时间:2024/06/06 03:47
- tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)
- tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)
- tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)
tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)
Crops an image to a specified bounding box.
This op cuts a rectangular part out of image
. The top-left corner of the returned image is at offset_height, offset_width
in image
, and its lower-right corner is at offset_height + target_height, offset_width + target_width
.
Args:
image
: 3-D tensor with shape[height, width, channels]
offset_height
: Vertical coordinate of the top-left corner of the result in the input.offset_width
: Horizontal coordinate of the top-left corner of the result in the input.target_height
: Height of the result.target_width
: Width of the result.
Returns:
3-D tensor of image with shape [target_height, target_width, channels]
Raises:
ValueError
: If the shape ofimage
is incompatible with theoffset_*
ortarget_*
arguments, or eitheroffset_height
oroffset_width
is negative, or eithertarget_height
ortarget_width
is not positive.
tf.image.extract_glimpse(input, size, offsets, centered=None, normalized=None, uniform_noise=None, name=None)
Extracts a glimpse from the input tensor.
Returns a set of windows called glimpses extracted at location offsets
from the input tensor. If the windows only partially overlaps the inputs, the non overlapping areas will be filled with random noise.
The result is a 4-D tensor of shape [batch_size, glimpse_height, glimpse_width, channels]
. The channels and batch dimensions are the same as that of the input tensor. The height and width of the output windows are specified in the size
parameter.
The argument normalized
and centered
controls how the windows are built:
- If the coordinates are normalized but not centered, 0.0 and 1.0 correspond to the minimum and maximum of each height and width dimension.
- If the coordinates are both normalized and centered, they range from -1.0 to 1.0. The coordinates (-1.0, -1.0) correspond to the upper left corner, the lower right corner is located at (1.0, 1.0) and the center is at (0, 0).
- If the coordinates are not normalized they are interpreted as numbers of pixels.
Args:
input
: ATensor
of typefloat32
. A 4-D float tensor of shape[batch_size, height, width, channels]
.size
: ATensor
of typeint32
. A 1-D tensor of 2 elements containing the size of the glimpses to extract. The glimpse height must be specified first, following by the glimpse width.(H, W)offsets
: ATensor
of typefloat32
. A 2-D integer tensor of shape[batch_size, 2]
containing the (y, x) locations of the center of each window.
centered
: An optionalbool
. Defaults toTrue
. indicates if the offset coordinates are centered relative to the image, in which case the (0, 0) offset is relative to the center of the input images. If false, the (0,0) offset corresponds to the upper left corner of the input images.normalized
: An optionalbool
. Defaults toTrue
. indicates if the offset coordinates are normalized.uniform_noise
: An optionalbool
. Defaults toTrue
. indicates if the noise should be generated using a uniform distribution or a gaussian distribution.name
: A name for the operation (optional).
Returns:
A Tensor
of type float32
. A tensor representing the glimpses [batch_size, glimpse_height, glimpse_width, channels]
.
tf.image.crop_and_resize(image, boxes, box_ind, crop_size, method=None, extrapolation_value=None, name=None)
Extracts crops from the input image tensor and bilinearly resizes them (possibly
with aspect ratio change) to a common output size specified by crop_size
. This is more general than the crop_to_bounding_box
op which extracts a fixed size slice from the input image and does not allow resizing or aspect ratio change.
Returns a tensor with crops
from the input image
at positions defined at the bounding box locations in boxes
. The cropped boxes are all resized (with bilinear interpolation) to a fixed size = [crop_height, crop_width]
. The result is a 4-D tensor [num_boxes, crop_height, crop_width, depth]
.
Args:
image
: ATensor
. Must be one of the following types:uint8
,int8
,int16
,int32
,int64
,half
,float32
,float64
. A 4-D tensor of shape[batch, image_height, image_width, depth]
. Bothimage_height
andimage_width
need to be positive.boxes
: ATensor
of typefloat32
. A 2-D tensor of shape[num_boxes, 4]
. Thei
-th row of the tensor specifies the coordinates of a box in thebox_ind[i]
image and is specified in normalized coordinates[y1, x1, y2, x2]
. A normalized coordinate value ofy
is mapped to the image coordinate aty * (image_height - 1)
, so as the[0, 1]
interval of normalized image height is mapped to[0, image_height - 1] in image height coordinates. We do allow y1 > y2, in which case the sampled crop is an up-down flipped version of the original image. The width dimension is treated similarly. Normalized coordinates outside the
[0, 1]range are allowed, in which case we use
extrapolation_value` to extrapolate the input image values.box_ind
: ATensor
of typeint32
. A 1-D tensor of shape[num_boxes]
with int32 values in[0, batch)
. The value ofbox_ind[i]
specifies the image that thei
-th box refers to.crop_size
: ATensor
of typeint32
. A 1-D tensor of 2 elements,size = [crop_height, crop_width]
. All cropped image patches are resized to this size. The aspect ratio of the image content is not preserved. Bothcrop_height
andcrop_width
need to be positive.method
: An optionalstring
from:"bilinear"
. Defaults to"bilinear"
. A string specifying the interpolation method. Only 'bilinear' is supported for now.extrapolation_value
: An optionalfloat
. Defaults to0
. Value used for extrapolation, when applicable.name
: A name for the operation (optional).
Returns:
A Tensor
of type float32
. A 4-D tensor of shape [num_boxes, crop_height, crop_width, depth]
.
- TensorFlow从图像提取区域的函数
- 一个图像目标区域提取的问题
- 采用OPENCV,从一幅图像中提取部分区域,并保存为新图像。
- 采用OPENCV,从一幅图像中提取部分区域,并保存为新图像
- 采用OPENCV,从一幅图像中提取部分区域,并保存为新图像。
- 基于轮廓的图像分割、连通区域提取
- 利用MSER算法提取图像区域(车牌区域)的OpenCV代码~
- OpenCV下采用等间隔提取和区域子块提取进行图像缩放的源程序!
- 文字区域的提取
- 图形图像处理之——实现图像子区域图像的简单提取
- opencv提取截获图像,任意区域
- ROI提取图像中部分区域
- opencv提取截获图像,任意区域
- Tensorflow 图像处理函数
- opencv 从原始的图像中找出ROI区域
- 图像显著性区域提取[2]-特征提取
- 四种简单的图像显著性区域特征提取方法-----AC/HC/LC/FT。
- 四种比较简单的图像显著性区域特征提取方法原理及实现
- hexo+github教程之四:配置hexo next主题第三方插件
- seleniumWebDriver的API操作显示等待_10_5
- 使用python和IBM speech to text 进行 语音识别
- hibernate在分层架构中修改数据(update)时遇到的问题!!
- 合唱团
- TensorFlow从图像提取区域的函数
- codeforces Dima and Trap Graph
- openwrt学习笔记一_feeds update报错
- hexo+github教程之五:github配置专属域名
- FIRST TOUCH-20170308-Swoole+Nginx+Redis(慢慢补)
- hexo+github教程之Markdown工具-MarkdownPad
- 找到两个数的差为一个特定数
- OpenSSL之EVP(三)——EVP对称算法编程示例
- 写在开篇