cv::convexHull broken (Bug #3040)
Description
Somehow convexHull doesn't produce useful results:
std::vector<cv::Point> quad(4); points[0] = cv::Point(10,5); points[1] = cv::Point(20,10); points[2] = cv::Point(20,20); points[3] = cv::Point(20,10); std::vector<cv::Point> hull; cv::convexHull(quad,hull,true,true); for (int i = 0; i < hull.size();++i) std::cout << "Hull " << i << " " << hull.at(i) << std::endl;
produces
Hull 0 [0, 0]
Did I oversee something? Just checked the docs. Variations with Point2f or just indices also produce various random results.
Just in case: Mac OS X 10.7 Lion, clang-64
History
Updated by Andrey Pavlenko almost 12 years ago
- Start date deleted (
2013-05-22) - Category set to imgproc, video
- Assignee set to Vadim Pisarevsky
Updated by Andrey Pavlenko over 11 years ago
- Target version set to Next Hackathon
Updated by Kirill Kornyakov over 11 years ago
deleted wrong comment
- Assignee deleted (
Vadim Pisarevsky) - Priority changed from High to Normal
Updated by Kirill Kornyakov over 11 years ago
Can't reproduce. May be this is because you fill points
vector, while processing quad
? Here is my code that works:
#include <opencv2/core/core.hpp> #include "opencv2/imgproc/imgproc.hpp" #include <iostream> using namespace std; int main () { std::vector<cv::Point> quad(4); quad[0] = cv::Point(10,5); quad[1] = cv::Point(20,10); quad[2] = cv::Point(20,20); quad[3] = cv::Point(20,10); std::vector<cv::Point> hull; cv::convexHull(quad, hull, true, true); for (int i = 0; i < hull.size();++i) std::cout << "Hull " << i << " " << hull.at(i) << std::endl; return 0; }
Output:
~/Work/OpenCV/build_linux_2.4> ./bin/cpp-example-convhull Hull 0 [10, 5] Hull 1 [20, 20] Hull 2 [20, 10]
- Assignee set to Hartmut Seichter
- Status changed from Open to Cancelled
- Target version changed from Next Hackathon to 2.4.6