justadudewhohacks / justadudewhohacks/opencv4nodejs
warpPerspetive keeps drawing image with black background
- Dominant language
- C++
- Stars
- 5.1k
- Forks
- 826
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I am new to opencv4nodejs and enjoying a lot processing images in different and fun ways.
However, I am having an issue with `cv.warpPerspective`.
With `opencv.js` copied from the [openCV website](https://docs.opencv.org/3.4/dd/d52/tutorial_js_geometric_transformations.html) and `cv.warpPerspective` allows me to get warped image with transparent/white background, but for some reason, I can't get it with `opencv4nodejs`.
I am getting an image drawn on a canvas so I converted it to base64 in order to make it into a Mat.
like `cv.imdecodeAsync(Buffer.from(canvasInBase64, 'base64'))`
then I have source and destination coordinates ready with `new cv.Point2()`
get it transformed with `cv.getPerspectiveTransform(sourceCoordinates, destinationCoordinates)`
and finally, warp it with `mat.warpPerspective(transformData, new cv.Size(width, height))`
Is there a way to get an image warped with transparent background with the codes above?
Thanks! Happy Coding!!
Contributor guide
Research direction
Start with the OpenCV.js geometric-transformations example and reproduce the reported flow through cv.imdecodeAsync, cv.getPerspectiveTransform, and mat.warpPerspective using the canvas base64 input and coordinate points. Done means determining whether this opencv4nodejs flow can produce the requested transparent or white background and documenting the required behavior or limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100