Object Detection  5.0
Image Processing Using Qt and Opencv
detectcircleimpl.cpp
1 #include "detectcircleimpl.h"
2 using namespace ImageProcessor;
3 
4 
5 DetectCircle::_DetectCircleImpl::_DetectCircleImpl(DetectCircle *const _ptr):
6  ptr{_ptr}
7 {
8 
9 }
10 
11 int DetectCircle::_DetectCircleImpl::getParam1() const
12 {
13  return param1;
14 }
15 
16 void DetectCircle::_DetectCircleImpl::setParam1(int value)
17 {
18  param1 = value;
19 }
20 
21 int DetectCircle::_DetectCircleImpl::getParam2() const
22 {
23  return param2;
24 }
25 
26 void DetectCircle::_DetectCircleImpl::setParam2(int value)
27 {
28  param2 = value;
29 }
30 
31 int DetectCircle::_DetectCircleImpl::getMinDist() const
32 {
33  return minDist;
34 }
35 
36 void DetectCircle::_DetectCircleImpl::setMinDist(int value)
37 {
38  minDist = value;
39 }
40 
41 std::vector<cv::Vec3f> DetectCircle::_DetectCircleImpl::detectCircle() const
42 {
43  cv::Mat temp = ptr -> getImg();
44  std::vector<cv::Vec3f> circles;
45  if(temp.type() != CV_8UC1)
46  cv::cvtColor(temp, temp, cv::COLOR_BGR2GRAY);
47  cv::HoughCircles(temp, circles, cv::HOUGH_GRADIENT, 1, getMinDist(), getParam1(), getParam2());
48  return circles;
49 }
50 
51 QVariant DetectCircle::_DetectCircleImpl::processImage()
52 {
53  std::vector<cv::Vec3f> circles = detectCircle();
54  emit ptr->circlesDetected(circles);
55  return QVariant::fromValue<std::vector<cv::Vec3f>> (circles);
56 }
57 
cv::Mat getImg() const
AbstractImageProcessor::getImg.
this class is used To Detect circles in an image
Definition: detectcircle.h:12
Common Namespace for all Image Processor Algorithms.