-
Notifications
You must be signed in to change notification settings - Fork 19
/
TennisCourtFitter.h
42 lines (31 loc) · 1.02 KB
/
TennisCourtFitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Created by Chlebus, Grzegorz on 28.08.17.
// Copyright (c) Chlebus, Grzegorz. All rights reserved.
//
#pragma once
#include "Line.h"
#include <opencv2/opencv.hpp>
#include "TennisCourtModel.h"
class TennisCourtFitter
{
public:
struct Parameters
{
Parameters();
};
TennisCourtFitter();
TennisCourtFitter(Parameters p);
TennisCourtModel run(const std::vector<Line>& lines, const cv::Mat& binaryImage, const cv::Mat& rgbImage);
static bool debug;
static const std::string windowName;
private:
void getHorizontalAndVerticalLines(const std::vector<Line>& lines, std::vector<Line>& hLines,
std::vector<Line>& vLines, const cv::Mat& rgbImage);
void sortHorizontalLines(std::vector<Line>& hLines, const cv::Mat& rgbImage);
void sortVerticalLines(std::vector<Line>& vLines, const cv::Mat& rgbImage);
void findBestModelFit(const cv::Mat& binaryImage, const cv::Mat& rgbImage);
Parameters parameters;
std::vector<LinePair> hLinePairs;
std::vector<LinePair> vLinePairs;
TennisCourtModel bestModel;
};