Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Contours expansion: minAreaRect and convexHull bindings, expose underlying point data #34

Merged
merged 3 commits into from Feb 11, 2013

Conversation

Projects
None yet
2 participants
@ghost

ghost commented Feb 10, 2013

Hey there! I needed access to some additional functions in OpenCV, so I went ahead and added a few more bindings to the Contours class.

Contours.minAreaRect maps to cv::minAreaRect, and returns an object describing the size, angle, and points of the RotatedRect.

Contours.convexHull maps to cv::convexHull, and takes the clockwise boolean as a parameter.

Contours.point allows access to the coordinates of the individual points that make up the contour.

spinda added some commits Feb 10, 2013

Expose point data from Contours
Add in a Point method to the Contours class to access the underlying
point coordinates from the JavaScript side.
Owner

peterbraden commented Feb 11, 2013

This is great, Thanks!

peterbraden added a commit that referenced this pull request Feb 11, 2013

Merge pull request #34 from mintplant/contours
Contours expansion: minAreaRect and convexHull bindings, expose underlying point data

@peterbraden peterbraden merged commit bb1fa03 into peterbraden:master Feb 11, 2013

1 check passed

default The Travis build passed
Details
Owner

peterbraden commented Feb 12, 2013

Hi, I'm actually getting some errors after pulling this in - It looks like in older versions of opencv they don't allow the output to be a matrix. Is there a way we can make this resilient to older opencv libraries?

../src/Contours.cc:132:2: error: no matching function for call to 'approxPolyDP'
approxPolyDP(cv::Mat(self->contours[pos]), approxed, epsilon, isClosed);
^~~~~~~~~~~~
/usr/local/include/opencv2/imgproc/imgproc.hpp:799:17: note: candidate function not viable: no known conversion from 'cv::Mat' to 'vector &' for 2nd argument;
CV_EXPORTS void approxPolyDP( const Mat& curve,
^
/usr/local/include/opencv2/imgproc/imgproc.hpp:803:17: note: candidate function not viable: no known conversion from 'cv::Mat' to 'vector &' for 2nd argument;
CV_EXPORTS void approxPolyDP( const Mat& curve,
^
../src/Contours.cc:149:2: error: no matching function for call to 'convexHull'
cv::convexHull(cv::Mat(self->contours[pos]), hull, clockwise);
^~~~~~~~~~~~~~
/usr/local/include/opencv2/imgproc/imgproc.hpp:822:17: note: candidate function not viable: no known conversion from 'cv::Mat' to 'vector &' for 2nd argument;
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector& hull, bool clockwise=false );
^
/usr/local/include/opencv2/imgproc/imgproc.hpp:824:17: note: candidate function not viable: no known conversion from 'cv::Mat' to 'vector &' for 2nd argument;
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector& hull, bool clockwise=false );
^
/usr/local/include/opencv2/imgproc/imgproc.hpp:826:17: note: candidate function not viable: no known conversion from 'cv::Mat' to 'vector &' for 2nd argument;
CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector& hull, bool clockwise=false );

Owner

peterbraden commented Feb 12, 2013

To clarify - this isn't really a deal breaker - this all works in the target version of opencv - I only noticed because I have an older version of opencv for testing, and wanted to know if there's an easy way to make this play nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment