Object Detection  5.0
Image Processing Using Qt and Opencv
ImageProcessor::DetectCircle Class Reference

this class is used To Detect circles in an image More...

+ Inheritance diagram for ImageProcessor::DetectCircle:
+ Collaboration diagram for ImageProcessor::DetectCircle:

Classes

class  _DetectCircleImpl
 

Public Slots

void setMinDist (int value)
 sets the minimum value between two circles More...
 
void setParam2 (int value)
 
void setParam1 (int value)
 
- Public Slots inherited from ImageProcessor::AbstractImageProcessor
virtual void setDst (const cv::Mat &dst)
 sets The output of the operation More...
 
virtual void setImg (const cv::Mat &img)
 

Signals

void circlesDetected (const std::vector< cv::Vec3f > &)
 this signal is emitted after detecting All the circles in the image being processed. More...
 
- Signals inherited from ImageProcessor::AbstractImageProcessor
void imageChanged (const cv::Mat &img)
 this Signal Is Emited When the source cv::Mat Object Changed.
 
void dstChanged (const cv::Mat &img)
 this Signal Is Emited When the destnation cv::Mat Object Changed. example: More...
 

Public Member Functions

 DetectCircle (QObject *parent=nullptr)
 
std::vector< cv::Vec3f > detectCircle () const
 this helper Function is used to detect circles in an Image using HoughCircle Algorithm. More...
 
int getMinDist () const
 
int getParam2 () const
 
int getParam1 () const
 
QVariant processImage () override
 reimplemented Function. More...
 
- Public Member Functions inherited from ImageProcessor::AbstractImageProcessor
cv::Mat getImg () const
 AbstractImageProcessor::getImg. More...
 
cv::Mat getDst () const
 returns A cv::Mat Object which represents the output of the image processing operation More...
 

Additional Inherited Members

- Protected Member Functions inherited from ImageProcessor::AbstractImageProcessor
 AbstractImageProcessor (QObject *parent=nullptr)
 accpets A pointer To the Parent Class For The Qt Meta-object Model See Qt Meta-Object More...
 

Detailed Description

this class is used To Detect circles in an image

using this class you can detect x, y and radius of a circle in an image after calling DetectColor::processImage there are many possible ways to get The output for example you can connect the signal ImageProcessor::DetectCircle::circlesDetected to any QObject Slot that takes std::vector<cv::Vec3f> as a parameter another way is to use the return of processImage and convert the QVarient to std::vector<cv::Vec3f>

connect(crcleDetector, &DetectCircle::circlesDetected, [=](const std::vector<cv::Vec3f>& vec){
for_each(vec.begin(), vec.end(), [](cv::Vec3f v){ qDebug() << v[0] << ", " << v[1] << ", " << v[2];});
});
std::vector<cv::Vec3f> vec = crcleDetector.processImage().value<std::vector<cv::Vec3f>>(); //and prints each x, y, r of every circle.
See also
ImageProcessor::DetectCircle::circlesDetected

Definition at line 12 of file detectcircle.h.

Member Function Documentation

◆ circlesDetected

ImageProcessor::DetectCircle::circlesDetected ( const std::vector< cv::Vec3f > &  )
signal

this signal is emitted after detecting All the circles in the image being processed.

can Be connected with other objects to get the circles in an image.

connect(crcleDetector, &DetectCircle::circlesDetected, [=](const std::vector<cv::Vec3f>& vec){
for_each(vec.begin(), vec.end(), [](cv::Vec3f v){ qDebug() << v[0] << ", " << v[1] << ", " << v[2];});
}; //prints each x, y, r of every circle.

◆ detectCircle()

std::vector< cv::Vec3f > DetectCircle::detectCircle ( ) const

this helper Function is used to detect circles in an Image using HoughCircle Algorithm.

Returns
a vector of 3 points vector each represents the x, y, r of all circles in the image.
See also
ImageProcessor::DetectCirlce::processImage.

Definition at line 66 of file detectcircle.cpp.

◆ processImage()

QVariant DetectCircle::processImage ( )
overridevirtual

reimplemented Function.

this function is reimplented to process a thresholded image of grayscale type to Detect All Cirlces.

See also
ImageProcessor::AbstractImageProcessor::processImage
Returns
std::vector<cv::Vec3f> a vector of cv::Vec3f where each index in it represents a circle which centers are x, y and radius.
using circleVec = std::vector<cv::Vec3f>;
auto i = circleDetector.processImage().value<circleVec>();
for(auto a : i){
qDebug() << "x = " << a[0] << ", y = " << a[1] << ", r = " << a[2]; //should iterate on each element and prints it's x, y, and radius.
}

Implements ImageProcessor::AbstractImageProcessor.

Definition at line 51 of file detectcircle.cpp.

+ Here is the call graph for this function:

◆ setMinDist

void DetectCircle::setMinDist ( int  value)
slot

sets the minimum value between two circles

Parameters
value
See also
ImageProcessor::DetectCircle::getMinDist

Definition at line 14 of file detectcircle.cpp.


The documentation for this class was generated from the following files: