 |
OpenCV
4.2.0
Open Source Computer Vision
|
An example using the Hough circle detector
using namespace std;
int main(int argc, char** argv)
{
const char* filename = argc >=2 ? argv[1] : "smarties.png";
printf(" Error opening image\n");
printf(" Program Arguments: [image_name -- default %s] \n", filename);
return EXIT_FAILURE;
}
vector<Vec3f> circles;
100, 30, 1, 30
);
for( size_t i = 0; i < circles.size(); i++ )
{
int radius = c[2];
}
imshow(
"detected circles", src);
return EXIT_SUCCESS;
}
int rows
the number of rows and columns or (-1, -1) when the matrix has more than 2 dimensions
Definition: mat.hpp:2086
If set, always convert image to the 3 channel BGR color image.
Definition: imgcodecs.hpp:67
void cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0)
Converts an image from one color space to another.
cv::String findFile(const cv::String &relative_path, bool required=true, bool silentMode=false)
Try to find requested data file.
int waitKey(int delay=0)
Waits for a pressed key.
Mat imread(const String &filename, int flags=IMREAD_COLOR)
Loads an image from a file.
bool empty() const
Returns true if the array has no elements.
void HoughCircles(InputArray image, OutputArray circles, int method, double dp, double minDist, double param1=100, double param2=100, int minRadius=0, int maxRadius=0)
Finds circles in a grayscale image using the Hough transform.
void medianBlur(InputArray src, OutputArray dst, int ksize)
Blurs an image using the median filter.
void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
Scalar_< double > Scalar
Definition: types.hpp:669
Point2i Point
Definition: types.hpp:194
basically 21HT, described in
Definition: imgproc.hpp:476
n-dimensional dense array class
Definition: mat.hpp:791
convert between RGB/BGR and grayscale, color conversions
Definition: imgproc.hpp:542
"black box" representation of the file storage associated with a file on disk.
Definition: affine.hpp:51
antialiased line
Definition: imgproc.hpp:807
void circle(InputOutputArray img, Point center, int radius, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws a circle.