Skip to content
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

region-of-interest decoding #4

Closed
1 task done
grez72 opened this issue Apr 16, 2024 · 3 comments
Closed
1 task done

region-of-interest decoding #4

grez72 opened this issue Apr 16, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@grez72
Copy link

grez72 commented Apr 16, 2024

Is this a new feature, an improvement, or a change to existing functionality?

New Feature

How would you describe the priority of this feature request

Must have (e.g. nvImageCodec adoption is impossible due to lack in functionality).

Please provide a clear description of problem this feature solves

I'm working with high-resolution images, but only need to decode a region-of-interest on any given pass over an image in my pipeline. The alternative is to decode entire images, then crop them, but this is far too slow when working with very high resolution images.

Feature Description

I see many of the decoders (e.g., nvjpeg2k/cuda_decoder.cpp) have an enable_roi flag and image_info.region parameters. I'm proposing to expose this functionality through the Python API. Ideally I would be able to decode a different region of interest for each image in a batch.

Describe your ideal solution

decoder = nvimgcodec.Decoder()

# region tuple (start_x, start_y, end_x, end_y) or list of tuples
rois = [ (0,0,150,150), (100,100,250,250)]

# decode regions of interest (one roi per image)
data_list = [img1_data, img2_data]
cropped_images = decoder.decode(data_list, region_of_interest=rois)

# or using read
file_list = [filepath_img1, filepath_img2]
cropped_images = decoder.read(data_list, region_of_interest=rois)

Describe any alternatives you have considered

I've looked into using nvidia-dali (nvidia.dali.fn.decoders.image_crop) but it doesn't fit into my current pipeline, which requires a stand-alone decoding solution (like nvImageCodec).

Additional context

No response

Check for duplicates

  • I have searched the open bugs/issues and have found no duplicates for this bug report
@grez72 grez72 added the enhancement New feature or request label Apr 16, 2024
@jantonguirao
Copy link
Collaborator

@grez72
Thank you for your request.
This is already in scope for our next release (we don't have a target date yet).
We'll let you know when it's ready.

@jantonguirao jantonguirao self-assigned this Apr 16, 2024
@jantonguirao
Copy link
Collaborator

The new release v0.3.0 enables this feature. Let us know if you find any issues.

@grez72
Copy link
Author

grez72 commented Oct 28, 2024

I've only had a chance to try on a few test images, but this looks great! Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants