some sample source codes in documentation need to be revised (Bug #4372)
Description
for example at this page [[http://docs.opencv.org/ref/master/dd/d1a/group__imgproc__feature.html]]
History
Updated by Suleyman TURKMEN almost 10 years ago
Suleyman TURKMEN wrote:
for example at this page [[http://docs.opencv.org/ref/master/dd/d1a/group__imgproc__feature.html]]
#include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> #include <math.h> using namespace cv; int main(int argc, char** argv) { Mat img, gray; if( argc != 2 && !(img=imread(argv[1], 1)).data) return -1; cvtColor(img, gray, COLOR_BGR2GRAY); // smooth it, otherwise a lot of false circles may be detected GaussianBlur( gray, gray, Size(9, 9), 2, 2 ); vector<Vec3f> circles; HoughCircles(gray, circles, HOUGH_GRADIENT, 2, gray->rows/4, 200, 100 ); for( size_t i = 0; i < circles.size(); i++ ) { Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); int radius = cvRound(circles[i][2]); // draw the circle center circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 ); // draw the circle outline circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 ); } namedWindow( "circles", 1 ); imshow( "circles", img ); return 0; }
must be like
#include <opencv2/imgproc.hpp> #include <opencv2/highgui.hpp> #include <math.h> using namespace cv; using namespace std; int main(int argc, char** argv) { Mat img, gray; if( argc != 2 && !(img=imread(argv[1], 1)).data) return -1; cvtColor(img, gray, COLOR_BGR2GRAY); // smooth it, otherwise a lot of false circles may be detected GaussianBlur( gray, gray, Size(9, 9), 2, 2 ); vector<Vec3f> circles; HoughCircles(gray, circles, HOUGH_GRADIENT, 2, gray.rows/4, 200, 100 ); for( size_t i = 0; i < circles.size(); i++ ) { Point center(cvRound(circles[i][0]), cvRound(circles[i][1])); int radius = cvRound(circles[i][2]); // draw the circle center circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 ); // draw the circle outline circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 ); } namedWindow( "circles", 1 ); imshow( "circles", img ); return 0; }
if i have right to change such documents i want to update it. but i don't know how to do that.
Updated by Steven Puttemans over 9 years ago
You need to supply a pull request, more information can be found here: http://code.opencv.org/projects/opencv/wiki/How_to_contribute
As to your changes. The -> to a . is correct ,but the second include of the std namespace is NOT needed!
- Status changed from New to Open
Updated by Suleyman TURKMEN over 9 years ago
Steven Puttemans wrote:
You need to supply a pull request, more information can be found here: http://code.opencv.org/projects/opencv/wiki/How_to_contribute
As to your changes. The -> to a . is correct ,but the second include of the std namespace is NOT needed!
i can't compile on code:block without std namespace "error: 'vector' was not declared in this scope"
Updated by Suleyman TURKMEN over 9 years ago
- % Done changed from 0 to 100
Updated by Maksim Shabunin over 9 years ago
- Status changed from Open to Done
- Pull request set to https://github.com/Itseez/opencv/pull/4112