Skip to content

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

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from

Conversation

quic-apreetam
Copy link

  • 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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@quic-apreetam
Copy link
Author

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);
Copy link
Contributor

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.

}
}

void warpAffine3Channel(InputArray _src, OutputArray _dst, InputArray _M, Size dsize, OutputArray _dstBorder)
Copy link
Contributor

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.

Comment on lines +31 to +32
CV_Assert(inv_scale_x > 0);
CV_Assert(inv_scale_y > 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The limitation is not documented in the function header.

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

Successfully merging this pull request may close these issues.

2 participants