opencv / opencv/opencv-python

Alternative to cv2.warpPerspective

Open
#549 8 comments 0 reactions 1 assignee View on GitHub

@AleksandrPanov is already working on this.

Since Oct 8, 2021.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

Expected behaviour

I use OpenCV to register bio-medical images, but these images are really big.

I'm able to extract features and compute the homography H, and then I use cv2.warpPerspective to compute the final image.

warped_img = cv2.warpPerspective(image, H, (width, height), borderMode=cv2.BORDER_CONSTANT, borderValue=0)
Actual behaviour

But when width or height is bigger than 32767, then I get the following error.

cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-s8zh4qlk/opencv/modules/imgproc/src/imgwarp.cpp:1724: error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && src.rows < SHRT_MAX in function 'remap'

I took a look online, and I found out that is a hard limitation because of the short encoding used to improve warpPerspective .

Is there a workaround to lift such limitation?
If no, is there a solution using another library to replace cv2.warpPerspective?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.