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

this class is used to detect a a colored circle object(s) More...

+ Inheritance diagram for ImageProcessor::ObjectDetection:
+ Collaboration diagram for ImageProcessor::ObjectDetection:

Classes

class  _ObjectDetectionImpl
 

Public Slots

void setCirDetector (DetectCircle *cirDetector)
 ObjectDetection::setCirDetector sets the circleDetector. More...
 
void setDiler (Dilate *diler)
 ObjectDetection::setDiler sets the dilate object. More...
 
void setColDetector (DetectColor *colDetector)
 
void addFilter (PluginSharedPointer proc)
 ObjectDetection::addFilter adds a filter from a plugin. More...
 
std::vector< PluginSharedPointer > getFilters () const
 
void setFilters (const std::vector< PluginSharedPointer > &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)
 

Public Member Functions

 ObjectDetection (QObject *parent=nullptr)
 ObjectDetection::ObjectDetection. More...
 
DilategetDiler () const
 ObjectDetection::getDiler. More...
 
DetectColorgetColDetector () const
 ObjectDetection::getColDetector. More...
 
DetectCirclegetCirDetector () const
 ObjectDetection::getCirDetector. More...
 
std::vector< cv::Vec3f > getCircles ()
 ObjectDetection::getCircles. More...
 
QVariant getResults () const
 
virtual QVariant processImage () override
 Pure Virtual Function representes the operation to be done on the Image to be processed. 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...
 

Protected Member Functions

void setResults (QVariant res)
 
cv::Mat applyFilters (cv::Mat dst) const
 ObjectDetection::applyFilters applies filters to the image. More...
 
- 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...
 

Additional Inherited Members

- 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...
 

Detailed Description

this class is used to detect a a colored circle object(s)

the class first thresholds the image to get the colored object using cv::threshold algorthim so you must supply a max and min colors as cv::Scalar using ImageProcessor::DetectColor after detecting color it applies a Morphological operation (dilation) using cv::Dilate algorthim and guassian blur to decrease the noise using cv::GuassianBlur using ImageProcssor::Dilate then applies filters using Plugins CircleDetectorPlugins::ImageProcessorPluginIFace then detect Circles using cv::HoughCircles ImageProcessor::DetectCircle

objdet.setImg(cv::imread(IMG_PATH));
auto var = objdet.processImage();
auto vec = var.value<std::vector<cv::Vec3f>>(); //or use var.getResults();
for(auto i : vec){
cout << "x: " << i[0] << " y:" << i[1] << " radius: " << i[2] << endl;
}
Author
Mohamed Khaled
Version
5.0

Definition at line 17 of file objectdetection.h.

Constructor & Destructor Documentation

◆ ObjectDetection()

ObjectDetection::ObjectDetection ( QObject *  parent = nullptr)
explicit

ObjectDetection::ObjectDetection.

Parameters
parent

Definition at line 9 of file objectdetection.cpp.

Member Function Documentation

◆ addFilter

void ObjectDetection::addFilter ( PluginSharedPointer  proc)
slot

ObjectDetection::addFilter adds a filter from a plugin.

See also
CircleDetectorPlugins::ImageProcessorPluginIFace
Parameters
proc

Definition at line 73 of file objectdetection.cpp.

◆ applyFilters()

Mat ObjectDetection::applyFilters ( cv::Mat  dst) const
protected

ObjectDetection::applyFilters applies filters to the image.

Exceptions
cv::Excpetion
Warning
neither exception safe nor thread safe
Parameters
dst
Returns

Definition at line 104 of file objectdetection.cpp.

◆ getCircles()

std::vector< Vec3f > ObjectDetection::getCircles ( )

ObjectDetection::getCircles.

Returns
returns the std::vector<cv::Vec3f> which encapsulate the data about circles like x,y and radius

Definition at line 42 of file objectdetection.cpp.

◆ getCirDetector()

DetectCircle * ObjectDetection::getCirDetector ( ) const

ObjectDetection::getCirDetector.

Returns
a pointer to ImageProcessor::DetectCircle used to to detect circles

Definition at line 34 of file objectdetection.cpp.

◆ getColDetector()

DetectColor * ObjectDetection::getColDetector ( ) const

ObjectDetection::getColDetector.

Returns
a pointer to the ImageProcessor::DetectColor used to detect colors

Definition at line 26 of file objectdetection.cpp.

◆ getDiler()

Dilate * ObjectDetection::getDiler ( ) const

ObjectDetection::getDiler.

Returns
an ImageProcessor::Dilate pointer to object

Definition at line 17 of file objectdetection.cpp.

◆ processImage()

QVariant ObjectDetection::processImage ( )
overridevirtual

Pure Virtual Function representes the operation to be done on the Image to be processed.

Exceptions
cv::Exception.notgarunteed to throw this exception
Warning
not exception nor thread safe.
Returns
QVariant Object which represents the output of the processing operation and it doesn't have to be cv::Mat.

Implements ImageProcessor::AbstractImageProcessor.

Definition at line 113 of file objectdetection.cpp.

◆ setCirDetector

void ObjectDetection::setCirDetector ( DetectCircle cirDetector)
slot

ObjectDetection::setCirDetector sets the circleDetector.

Parameters
cirDetector

Definition at line 51 of file objectdetection.cpp.

◆ setDiler

void ObjectDetection::setDiler ( Dilate diler)
slot

ObjectDetection::setDiler sets the dilate object.

Parameters
diler

Definition at line 59 of file objectdetection.cpp.


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