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
Refactor and improve image resizing #634
Comments
Not sure if it is related, I will also be interested in adding resizing functions that resize images to exact sizes, either by cropping or padding. Currently, I have this function defined inside the function generating time_lapse_video. |
Hi @DannieSheng, it did come to my mind while I was reviewing your PR! I realized that the resize function you proposed there does not use interpolation though, it either crops or pads as you said. Maybe now that I think about it, these could potentially be one function?
|
Yes, this makes sense! :) |
I wrote up my results for data fusion / image overlays mentioned #615 (comment) also, since you are refactoring:
links I found useful: |
I opened a new issue to migrate Warp is added and we can soft-deprecate Should we open any new issue(s) for point 3 above @dschneiderch? |
@nfahlgren probably not necessary. i can't think of any applications for shear or skew over warp. it can always be revisited. |
Is your feature request related to a problem? Please describe.
The function
plantcv.resize
could be improved in a few ways. It currently allows for resizing the x and y dimensions using scaling factors, but resizing to an exact size may be desirable also. We also use a single, fixed interpolation method that may not yield optimal results in all cases.Describe the solution you'd like
I propose a few modifications to
plantcv.resize
and a new function.plantcv.resize
to thetransform
subpackage:plantcv.transform.resize
. This is both because it is a transformation of the input image and it's consistent withscikit-image
.plantcv.transform.resize
to resize images to an exact size.plantcv.transform.resize
, if the new size is smaller than the input size, use the OpenCV interpolation methodcv2.INTER_AREA
. If the new size is larger than the input size, use the interpolation methodcv2.INTER_CUBIC
. (These are the generally recommended options, but we could point a user to the OpenCV function if they want more control than what we provide).plantcv.transform.resize_factor
that combines the new features proposed forplantcv.transform.resize
but uses the current feature of scaling the sizes by factors rather than exact sizes.Describe alternatives you've considered
These functions could be wrapped into one like the OpenCV function, but I think it's simpler to have two smaller functions rather than twice the inputs to one.
The text was updated successfully, but these errors were encountered: