How to create MatVector object to be used in drawContours function using 4 points?
c1 = new opencv_core.Point2f(4); c1.position(0).put(attachment.points[0]); c1.position(1).put(attachment.points[1]); c1.position(2).put(attachment.points[2]); c1.position(3).put(attachment.points[3]); opencv_core.Mat dist = new opencv_core.Mat(c1); opencv_core.MatVector co_ordinates = new opencv_core.MatVector(1); co_ordinates.put(0,dist);
opencv_core.Mat mask = new opencv_core.Mat((int)cameraFrameSize.height(), (int)cameraFrameSize.width(), CV_8UC1, new opencv_core.Scalar(0)); drawContours(mask, co_ordinates, 0, new opencv_core.Scalar(255),FILLED, LINE_8 , noArray() , 2 , new opencv_core.Point());
error result : -
12-08 14:09:36.272 3280-3896/org.bytedeco.javacv.android.example D/error sdam: /home/saudet/projects/bytedeco/javacpp-presets/opencv/cppbuild/android-arm/opencv-3.2.0/modules/imgproc/src/drawing.cpp:2481: error: (-215) npoints > 0 in function void cv::drawContours(cv::InputOutputArray, cv::InputArrayOfArrays, int, const Scalar&, int, int, cv::InputArray, int, cv::Point)
I tried it and it does not work. We need to pass a Pointer to create a
CvMat like CvMat mat = new CvMat(Pointer). On the other hand we don't
have Point2f in JavaCV we have something like cvPoint2D32f ...
*My real problem is this:*
Thought I might provide some context to help you answer my question.
Basically, I'm trying to crop a receipt out from a photo ignoring the
background etc.
I've been able to determine the points but in essence, don't know how to
choose the best 4 points(4 corners of the paper) which allow me to crop
the receipt out from the photo.
See my results below.
One of my solution is putting all these blue dots/points into a
contour/CvMat and see if I can apply approxPolyDp and best 4 corners out
of the contour but I tried it in C++ and it does not work. So I need to
approach the problem differently.
--
---
You received this message because you are subscribed to the Google Groups "javacv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacv+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.