tfg.image.transformer.sample
Stay organized with collections
Save and categorize content based on your preferences.
Samples an image at user defined coordinates.
tfg.image.transformer.sample(
image: type_alias.TensorLike,
warp: type_alias.TensorLike,
resampling_type: tfg.image.transformer.ResamplingType
= tfg.image.transformer.ResamplingType.BILINEAR
,
border_type: tfg.image.transformer.BorderType
= tfg.image.transformer.BorderType.ZERO
,
pixel_type: tfg.image.transformer.PixelType
= tfg.image.transformer.PixelType.HALF_INTEGER
,
name: Optional[str] = 'sample'
) -> tf.Tensor
Note |
The warp maps target to source. In the following, A1 to An are optional
batch dimensions.
|
Args |
image: A tensor of shape [B, H_i, W_i, C] , where B is the batch size,
H_i the height of the image, W_i the width of the image, and C the
number of channels of the image.
warp: A tensor of shape [B, A_1, ..., A_n, 2] containing the x and y
coordinates at which sampling will be performed. The last dimension must
be 2, representing the (x, y) coordinate where x is the index for width
and y is the index for height.
|
resampling_type
|
Resampling mode. Supported values are
ResamplingType.NEAREST and ResamplingType.BILINEAR .
border_type: Border mode. Supported values are BorderType.ZERO and
BorderType.DUPLICATE .
pixel_type: Pixel mode. Supported values are PixelType.INTEGER and
PixelType.HALF_INTEGER .
name: A name for this op. Defaults to "sample".
|
Returns |
Tensor of sampled values from image . The output tensor shape
is [B, A_1, ..., A_n, C] .
|
Raises |
ValueError
|
If image has rank != 4. If warp has rank < 2 or its last
dimension is not 2. If image and warp batch dimension does not match.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2022-10-28 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-10-28 UTC."],[],[]]