-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support applying orientation in Convert #4219
Conversation
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
dali/imgcodec/util/convert.cc
Outdated
@@ -25,8 +25,8 @@ namespace imgcodec { | |||
|
|||
void Convert(SampleView<CPUBackend> out, TensorLayout out_layout, DALIImageType out_format, | |||
ConstSampleView<CPUBackend> in, TensorLayout in_layout, DALIImageType in_format, | |||
TensorShape<> roi_start, TensorShape<> roi_end) { | |||
const auto &out_shape = out.shape(); | |||
TensorShape<> roi_start, TensorShape<> roi_end, Orientation orientation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TensorShape<> roi_start, TensorShape<> roi_end, Orientation orientation) { | |
const ROI &roi, Orientation orientation) { |
Adjusting this now that we have the ROI type would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done!
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
!build |
CI MESSAGE: [5958642]: BUILD STARTED |
CI MESSAGE: [5958656]: BUILD STARTED |
CI MESSAGE: [5958642]: BUILD FAILED |
Signed-off-by: Joaquin Anton <janton@nvidia.com>
!build |
CI MESSAGE: [5958656]: BUILD FAILED |
CI MESSAGE: [5958717]: BUILD STARTED |
CI MESSAGE: [5958717]: BUILD PASSED |
Images may be stored in an orientation other than the actual one and contain a tag (see EXIF orientation) indicating that the image should be transformed (for example rotated) after decoding. In this PR I extend Convert function with an ability to rectify an image according to the orientation information. Additional information: The implemented solution is not the fastest one, but is definitely the simplest: I adjust the strides, sizes and pointer of the output tensor in such a way, that the data is stored there in appropriate order. A function responsible for that is `ApplyOrientation`. Not all decoders use the high-level Convert, some (such as TIFF) use lower-level version. In this case `ApplyOrientation` can be used directly in order to modify the strides, sizes and pointer. Signed-off-by: Szymon Karpiński <skarpinski@nvidia.com>
Category:
New feature (non-breaking change which adds functionality)
Description:
Images may be stored in an orientation other than the actual one and contain a tag (see EXIF orientation) indicating that the image should be transformed (for example rotated) after decoding.
In this PR I extend
Convert
function with an ability to rectify an image according to the orientation information.Additional information:
The implemented solution is not the fastest one, but is definetely the simplest: I adjust the strides, sizes and pointer of the output tensor in such a way, that the data is stored there in appropriate order. A function responsible for that is
ApplyOrientation
.Not all decoders use the high-level
Convert
, some (such as TIFF) use lower-level version. In thiscase
ApplyOrientation
can be used directly in order to modify the strides, sizes and pointer.Affected modules and functionalities:
imgcodec/util/convert*
. Another (optional) parameterorientation
was added toConvert
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-2995