Equivalent to OpenCV's cv2.warpPerspective?
Equivalent to OpenCV's cv2.warpPerspective?
I'd like to convert an oblique image to one that looks like it was taken from above, which in OpenCV would be done with the cv2.warpPerspective or cv2.perspectiveTransform functions. I can't find anything quite like that in OpenMV, but is there some combination of transforms that would accomplish the same thing?
Re: Equivalent to OpenCV's cv2.warpPerspective?
I don't think we have anything like that. Um, what's the use case?
Nyamekye,
Re: Equivalent to OpenCV's cv2.warpPerspective?
Driving autonomous cars like this. https://wroscoe.github.io/compound-eye- ... -autopilot
That function turns distorted ground-level camera views into easy-to-parse top level views.
So this turns into this:
That function turns distorted ground-level camera views into easy-to-parse top level views.
So this turns into this:
Re: Equivalent to OpenCV's cv2.warpPerspective?
Okay, so, I could implement a function to do this but it's going to kill the frame rate. Not sure if that makes any sense. Seems like it would be smarter to just deal with the mathematics of the lines found that trying to make them parallel. I can guess roughly that the M7 will only be able to achieve about 10 FPS once you apply a perspective fix like that.
Nyamekye,
Re: Equivalent to OpenCV's cv2.warpPerspective?
Actually 10 FPS is fine for cars.
The reason to do this is not to make it easier to find the lines, but rather to do this:
"To calculate the steering angle we'll use a perspective transform to simulate a birds eye view from the tip. This way we can calculate the actual angle of the line relative to the car."
There are probably other good ways to do that without a perspective transform, but it does neatly address the problem of lines being both translated (car is closer or further from them) as well as rotated (car is not running parallel to them), which can make the math tricky otherwise.
The reason to do this is not to make it easier to find the lines, but rather to do this:
"To calculate the steering angle we'll use a perspective transform to simulate a birds eye view from the tip. This way we can calculate the actual angle of the line relative to the car."
There are probably other good ways to do that without a perspective transform, but it does neatly address the problem of lines being both translated (car is closer or further from them) as well as rotated (car is not running parallel to them), which can make the math tricky otherwise.
Re: Equivalent to OpenCV's cv2.warpPerspective?
I can probably add a general purpose perspective transform function then. Seen this code twice now for QR Code and AprilTags. Can just copy if from there. You can then just supply a sequence of X/Y/Z rotations.
Nyamekye,
Re: Equivalent to OpenCV's cv2.warpPerspective?
I think it would be *much* faster to first find the line on the image, and *then* apply the perspective transformation to the ends of that line, instead of applying it to each and every pixel in the image.
Re: Equivalent to OpenCV's cv2.warpPerspective?
@ kwagyeman Have some example code to be test,Thanks!
Return to “Technical Discussion”
Who is online
Users browsing this forum: Bing [Bot] and 1 guest