//
// Created by Martin Gargalovič on 10. 8. 2021.
//

#ifndef ARC_SUPPORT_GROUPFORMING_H
#define ARC_SUPPORT_GROUPFORMING_H

#include <vector>
#include <opencv2/core.hpp>
#include "utility.h"
/**
 * searches for consecutive line segments that connect to each other
 * @param start is starting arc line segment for the grouping
 * @param marked is an image with segmented lines
 * @param used array of bool, describes which arcs were already searched
 * @param rectangles array of rectangle approximations for arc-segments
 * @param headRegion bool value to decide whether to search head or tail of the arc-segment for consecutive lines
 * @return group of consecutive arc line segments that connect to each other
 */
std::vector<int>
supportGroup(size_t start, cv::Mat &marked, std::vector<bool> &used,
             std::vector<rectangle> &rectangles, int search_size,
             bool headRegion);

/**
 * connects arc line segments into groups forming arcs of an ellipse.
 * @param marked is an image with segmented lines
 * @param rectangles array of rectangle approximations for arc-segments
 * @return groups of connecting arc-segments
 */
std::vector<std::pair<std::vector<int>, double>>
groupForm(cv::Mat &marked, int searchSize, std::vector<rectangle> &rectangles);

#endif //ARC_SUPPORT_GROUPFORMING_H
