Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/_api/v2/compat/v1/image/__init__.py: 100%

72 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 07:57 +0000

1# This file is MACHINE GENERATED! Do not edit. 

2# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. 

3"""Image ops. 

4 

5The `tf.image` module contains various functions for image 

6processing and decoding-encoding Ops. 

7 

8Many of the encoding/decoding functions are also available in the 

9core `tf.io` module. 

10 

11## Image processing 

12 

13### Resizing 

14 

15The resizing Ops accept input images as tensors of several types. They always 

16output resized images as float32 tensors. 

17 

18The convenience function `tf.image.resize` supports both 4-D 

19and 3-D tensors as input and output. 4-D tensors are for batches of images, 

203-D tensors for individual images. 

21 

22Resized images will be distorted if their original aspect ratio is not the 

23same as size. To avoid distortions see tf.image.resize_with_pad. 

24 

25* `tf.image.resize` 

26* `tf.image.resize_with_pad` 

27* `tf.image.resize_with_crop_or_pad` 

28 

29The Class `tf.image.ResizeMethod` provides various resize methods like 

30`bilinear`, `nearest_neighbor`. 

31 

32### Converting Between Colorspaces 

33 

34Image ops work either on individual images or on batches of images, depending on 

35the shape of their input Tensor. 

36 

37If 3-D, the shape is `[height, width, channels]`, and the Tensor represents one 

38image. If 4-D, the shape is `[batch_size, height, width, channels]`, and the 

39Tensor represents `batch_size` images. 

40 

41Currently, `channels` can usefully be 1, 2, 3, or 4. Single-channel images are 

42grayscale, images with 3 channels are encoded as either RGB or HSV. Images 

43with 2 or 4 channels include an alpha channel, which has to be stripped from the 

44image before passing the image to most image processing functions (and can be 

45re-attached later). 

46 

47Internally, images are either stored in as one `float32` per channel per pixel 

48(implicitly, values are assumed to lie in `[0,1)`) or one `uint8` per channel 

49per pixel (values are assumed to lie in `[0,255]`). 

50 

51TensorFlow can convert between images in RGB or HSV or YIQ. 

52 

53* `tf.image.rgb_to_grayscale`, `tf.image.grayscale_to_rgb` 

54* `tf.image.rgb_to_hsv`, `tf.image.hsv_to_rgb` 

55* `tf.image.rgb_to_yiq`, `tf.image.yiq_to_rgb` 

56* `tf.image.rgb_to_yuv`, `tf.image.yuv_to_rgb` 

57* `tf.image.image_gradients` 

58* `tf.image.convert_image_dtype` 

59 

60### Image Adjustments 

61 

62TensorFlow provides functions to adjust images in various ways: brightness, 

63contrast, hue, and saturation. Each adjustment can be done with predefined 

64parameters or with random parameters picked from predefined intervals. Random 

65adjustments are often useful to expand a training set and reduce overfitting. 

66 

67If several adjustments are chained it is advisable to minimize the number of 

68redundant conversions by first converting the images to the most natural data 

69type and representation. 

70 

71* `tf.image.adjust_brightness` 

72* `tf.image.adjust_contrast` 

73* `tf.image.adjust_gamma` 

74* `tf.image.adjust_hue` 

75* `tf.image.adjust_jpeg_quality` 

76* `tf.image.adjust_saturation` 

77* `tf.image.random_brightness` 

78* `tf.image.random_contrast` 

79* `tf.image.random_hue` 

80* `tf.image.random_saturation` 

81* `tf.image.per_image_standardization` 

82 

83### Working with Bounding Boxes 

84 

85* `tf.image.draw_bounding_boxes` 

86* `tf.image.combined_non_max_suppression` 

87* `tf.image.generate_bounding_box_proposals` 

88* `tf.image.non_max_suppression` 

89* `tf.image.non_max_suppression_overlaps` 

90* `tf.image.non_max_suppression_padded` 

91* `tf.image.non_max_suppression_with_scores` 

92* `tf.image.pad_to_bounding_box` 

93* `tf.image.sample_distorted_bounding_box` 

94 

95### Cropping 

96 

97* `tf.image.central_crop` 

98* `tf.image.crop_and_resize` 

99* `tf.image.crop_to_bounding_box` 

100* `tf.io.decode_and_crop_jpeg` 

101* `tf.image.extract_glimpse` 

102* `tf.image.random_crop` 

103* `tf.image.resize_with_crop_or_pad` 

104 

105### Flipping, Rotating and Transposing 

106 

107* `tf.image.flip_left_right` 

108* `tf.image.flip_up_down` 

109* `tf.image.random_flip_left_right` 

110* `tf.image.random_flip_up_down` 

111* `tf.image.rot90` 

112* `tf.image.transpose` 

113 

114## Image decoding and encoding 

115 

116TensorFlow provides Ops to decode and encode JPEG and PNG formats. Encoded 

117images are represented by scalar string Tensors, decoded images by 3-D uint8 

118tensors of shape `[height, width, channels]`. (PNG also supports uint16.) 

119 

120Note: `decode_gif` returns a 4-D array `[num_frames, height, width, 3]` 

121 

122The encode and decode Ops apply to one image at a time. Their input and output 

123are all of variable size. If you need fixed size images, pass the output of 

124the decode Ops to one of the cropping and resizing Ops. 

125 

126* `tf.io.decode_bmp` 

127* `tf.io.decode_gif` 

128* `tf.io.decode_image` 

129* `tf.io.decode_jpeg` 

130* `tf.io.decode_and_crop_jpeg` 

131* `tf.io.decode_png` 

132* `tf.io.encode_jpeg` 

133* `tf.io.encode_png` 

134 

135 

136""" 

137 

138import sys as _sys 

139 

140from tensorflow.python.ops.array_ops import extract_image_patches 

141from tensorflow.python.ops.array_ops import extract_image_patches_v2 as extract_patches 

142from tensorflow.python.ops.gen_image_ops import decode_and_crop_jpeg 

143from tensorflow.python.ops.gen_image_ops import decode_bmp 

144from tensorflow.python.ops.gen_image_ops import decode_gif 

145from tensorflow.python.ops.gen_image_ops import decode_jpeg 

146from tensorflow.python.ops.gen_image_ops import decode_png 

147from tensorflow.python.ops.gen_image_ops import encode_jpeg 

148from tensorflow.python.ops.gen_image_ops import extract_jpeg_shape 

149from tensorflow.python.ops.gen_image_ops import hsv_to_rgb 

150from tensorflow.python.ops.gen_image_ops import resize_area 

151from tensorflow.python.ops.gen_image_ops import rgb_to_hsv 

152from tensorflow.python.ops.image_ops_impl import ResizeMethodV1 as ResizeMethod 

153from tensorflow.python.ops.image_ops_impl import adjust_brightness 

154from tensorflow.python.ops.image_ops_impl import adjust_contrast 

155from tensorflow.python.ops.image_ops_impl import adjust_gamma 

156from tensorflow.python.ops.image_ops_impl import adjust_hue 

157from tensorflow.python.ops.image_ops_impl import adjust_jpeg_quality 

158from tensorflow.python.ops.image_ops_impl import adjust_saturation 

159from tensorflow.python.ops.image_ops_impl import central_crop 

160from tensorflow.python.ops.image_ops_impl import combined_non_max_suppression 

161from tensorflow.python.ops.image_ops_impl import convert_image_dtype 

162from tensorflow.python.ops.image_ops_impl import crop_and_resize_v1 as crop_and_resize 

163from tensorflow.python.ops.image_ops_impl import crop_to_bounding_box 

164from tensorflow.python.ops.image_ops_impl import decode_image 

165from tensorflow.python.ops.image_ops_impl import draw_bounding_boxes 

166from tensorflow.python.ops.image_ops_impl import encode_png 

167from tensorflow.python.ops.image_ops_impl import extract_glimpse 

168from tensorflow.python.ops.image_ops_impl import flip_left_right 

169from tensorflow.python.ops.image_ops_impl import flip_up_down 

170from tensorflow.python.ops.image_ops_impl import generate_bounding_box_proposals 

171from tensorflow.python.ops.image_ops_impl import grayscale_to_rgb 

172from tensorflow.python.ops.image_ops_impl import image_gradients 

173from tensorflow.python.ops.image_ops_impl import is_jpeg 

174from tensorflow.python.ops.image_ops_impl import non_max_suppression 

175from tensorflow.python.ops.image_ops_impl import non_max_suppression_padded 

176from tensorflow.python.ops.image_ops_impl import non_max_suppression_with_overlaps as non_max_suppression_overlaps 

177from tensorflow.python.ops.image_ops_impl import non_max_suppression_with_scores 

178from tensorflow.python.ops.image_ops_impl import pad_to_bounding_box 

179from tensorflow.python.ops.image_ops_impl import per_image_standardization 

180from tensorflow.python.ops.image_ops_impl import psnr 

181from tensorflow.python.ops.image_ops_impl import random_brightness 

182from tensorflow.python.ops.image_ops_impl import random_contrast 

183from tensorflow.python.ops.image_ops_impl import random_flip_left_right 

184from tensorflow.python.ops.image_ops_impl import random_flip_up_down 

185from tensorflow.python.ops.image_ops_impl import random_hue 

186from tensorflow.python.ops.image_ops_impl import random_jpeg_quality 

187from tensorflow.python.ops.image_ops_impl import random_saturation 

188from tensorflow.python.ops.image_ops_impl import resize_bicubic 

189from tensorflow.python.ops.image_ops_impl import resize_bilinear 

190from tensorflow.python.ops.image_ops_impl import resize_image_with_crop_or_pad 

191from tensorflow.python.ops.image_ops_impl import resize_image_with_crop_or_pad as resize_with_crop_or_pad 

192from tensorflow.python.ops.image_ops_impl import resize_image_with_pad_v1 as resize_image_with_pad 

193from tensorflow.python.ops.image_ops_impl import resize_images 

194from tensorflow.python.ops.image_ops_impl import resize_images as resize 

195from tensorflow.python.ops.image_ops_impl import resize_nearest_neighbor 

196from tensorflow.python.ops.image_ops_impl import rgb_to_grayscale 

197from tensorflow.python.ops.image_ops_impl import rgb_to_yiq 

198from tensorflow.python.ops.image_ops_impl import rgb_to_yuv 

199from tensorflow.python.ops.image_ops_impl import rot90 

200from tensorflow.python.ops.image_ops_impl import sample_distorted_bounding_box 

201from tensorflow.python.ops.image_ops_impl import sobel_edges 

202from tensorflow.python.ops.image_ops_impl import ssim 

203from tensorflow.python.ops.image_ops_impl import ssim_multiscale 

204from tensorflow.python.ops.image_ops_impl import total_variation 

205from tensorflow.python.ops.image_ops_impl import transpose 

206from tensorflow.python.ops.image_ops_impl import transpose as transpose_image 

207from tensorflow.python.ops.image_ops_impl import yiq_to_rgb 

208from tensorflow.python.ops.image_ops_impl import yuv_to_rgb 

209from tensorflow.python.ops.random_ops import random_crop