//
// Created by martin on 16. 2. 2021.
//
#ifndef ARC_MATRIX_DP_H
#define ARC_MATRIX_DP_H
#include <opencv2/core.hpp>




/**
 * @param a start point of a line
 * @param b end point of a line
 * @param x the point we are calculating distance of
 * calcs distance using the formula (2) from parameter independent line fitting method (Prasad,Leung,Cho)
 */
double dist(cv::Point2i &a,cv::Point2i &b ,cv::Point2i &x);
/**
 * calcs derived fi max for D_tol
 */
double maxFi(double fi, double s);

/**
 * @Param edges is a binary image containing 1s for edges and 0 for background
 * returns vector of points that are creating the edge
 */
std::vector<cv::Point2i> getEdges(const cv::Mat& edges);


/**
 * @param edges contain all edges of the image (might change into cv::Mat
 * @param X starting point of a line
 * @param Y ending point of a line
 * @param DP storing space for DP-contour
 * reduces the amount of points needed to represent the contours
 */
void L_DPR(std::vector<cv::Point2i> &edges, int X, int Y,std::vector<cv::Point2i>& DP);


// not too sure what to do with this thing below, just separating code to more files.

/**
 * creates DP of the whole image
 * @param contours contains contours of the image
 * @return DP contour
 */
std::vector<std::vector<cv::Point2i>> getDP(std::vector<std::vector<cv::Point2i>> &contours);

#endif //ARC_MATRIX_DP_H
