I am writing a C++ plugin and I would like to work with the target as it appears inside the cameraFrame with the perspective corrected (as it would look like if it were looked upon from a peferct angle).
Is there a way to get the path around the target inside cameraFrame? I found getTargetPositionInCameraFrame inside RecognizedTarget but it seems like its a bounding box. Ideally I would like to feed cameraFrame into cv::warpPerspective and get a rect into the resulting image to cut the target.
Am I missing something?
about 2 years ago
Hi David, What do you mean by 'path around the target'? Currently we only have getTargetPositionInCameraFrame and yes, it's the bounding box of the reference image. You would need to extract the corresponding pixels from the camera image which is available with the 'cameraFrameAvailable' method.
about 2 years ago
What do you mean by 'path around the target'? The outline of the target. I want to be able to examine the detected target image and its souroundings without the perspective. I attached an image of what i want to get.
almost 2 years ago
Hi David, Currently you only have getTargetPositionInCameraFrame. This gives you the region in pixel values where the target image was found. The rotation and translation to get from this rectangle to your path is included in the matrices that you get from the plugin api (In the RecognizedTarget object that is given in ::update). You should be able to extract the needed 3x3 OpenCV matrix from our 4x4 OpenGL matrix.
So you can use the first set of informations to extract the image region that contains the target image and with the given set of matrices, be able to do the perspective correction.
10 months ago
I want to achieve exactly the same thing (extract the target from the camera frame, and apply an openCV correction to it to remove perspective)