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

Speed up image cropping and resizing #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krikru
Copy link

@krikru krikru commented Aug 9, 2019

No description provided.

@krikru krikru force-pushed the speed-up-image-resizing branch from 570fbaa to 9111635 Compare August 9, 2019 16:09
Make the function center_crop_and_resize() support non-quadratic
output shapes and crop padding shapes. The arguments image_size and
crop_padding should be able to either be scalars (like they currently
are) or lists or tuples containing both a height and a width.
@krikru krikru force-pushed the speed-up-image-resizing branch from 9111635 to 3daf692 Compare August 9, 2019 16:39
@qubvel
Copy link
Owner

qubvel commented Aug 9, 2019

Hi @krikru
Thanks for proposed changes, but I am not sure that OpenCV dependencies is a good choice, you could wrap it in try except block, if cv2 is exists use it, else skimage.

@krikru krikru force-pushed the speed-up-image-resizing branch from 3daf692 to e6dc68c Compare August 14, 2019 15:06
@krikru
Copy link
Author

krikru commented Aug 14, 2019

I have updated my pull request. How does this code look?

@krikru krikru force-pushed the speed-up-image-resizing branch from e6dc68c to 36bb0b3 Compare August 14, 2019 15:13
To make the process of cropping and resizing images go faster, switch
from the resize function in skimage.transform to the resize function
in cv2 if cv2 is available on the system, otherwise stick with
skimage.transform.resize.
@krikru krikru force-pushed the speed-up-image-resizing branch from 36bb0b3 to 0defe1c Compare August 14, 2019 15:14
@krikru
Copy link
Author

krikru commented Oct 23, 2019

@qubvel I have three pending pull requests, including this one. Will they be merged?

@Clara85
Copy link

Clara85 commented Feb 6, 2020

Opencv returns BGR image, while scikit-image returns RGB image, I wonder if you tested the result?

@krikru
Copy link
Author

krikru commented Feb 24, 2020

@Clara85 Tested in what regard? When resizing, OpenCV only returns a BGR image if it is fed a BGR image as input; if you feed it an RGB image it will also return an RGB image (it has no way of telling whether the image is a BGR or an RGB image, and therefore won't rearrange the channel order).

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

Successfully merging this pull request may close these issues.

3 participants