-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add warpAffine and resizeDown APIs in FastCV Extension #3936
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
base: 4.x
Are you sure you want to change the base?
Conversation
hi @asmorkalov, i think we don't need dummy PR for this |
* | ||
* @return Returns 0 if the transformation is valid. | ||
*/ | ||
CV_EXPORTS_W void warpAffineROI(InputArray _src, const cv::Point2f& position, InputArray _affine, OutputArray _patch, Size patchSize); |
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.
Technically, the API is redundant. OpenCV cv::Mat has locateRoi method that may extract details of the original matrix, if roi is provided as a parameter. You can just handle the case in existing warpAffine.
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.
in warpAffineROI, we use fcvTransformAffineu8_v2 which uses 2x2 Affine transformation and also uses fixed point precision, that's why it was added separately
} | ||
} | ||
|
||
void warpAffine3Channel(InputArray _src, OutputArray _dst, InputArray _M, Size dsize, OutputArray _dstBorder) |
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.
Technically, you do not need extra API call. You can handle amount of channels in warpAffine in run time and select proper FastCV call.
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.
the decision to use separate API was due to the reason that warpAffine3Channel does not support interpolation or bordervalue, and could be confusing
Added warpAffine function to apply affine transformations to grayscale images using a 2x3 matrix.
Added warpAffine3Channel function to apply affine transformations to 3-channel RGB images with bicubic interpolation.
Added warpAffineROI function to warp a patch centered at a specified position in the input image using a 2x2 affine matrix.
Deprecated resizeDownBy2 and resizeDownBy4 functions.
Introduced resizeDown function to down-scale images using specified scaling factors or dimensions, supporting both single-channel (CV_8UC1) and two-channel (CV_8UC2) images.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.