//
// Created by Martin Gargalovič on 9. 11. 2021.
//

#ifndef ARC_SUPPORT_LSD2OCV_H
#define ARC_SUPPORT_LSD2OCV_H


#include <vector>
#include <opencv2/core/types.hpp>
#include "utility.h"


/**
* parametrized LSD
 * @param n_out returns the amount of arc segments found
 * @param img image for line extraction
 * @param X width of the image
 * @param Y height of the image
 * @param scale scales the image depending on this ratio (downscaled image may contribute to better line finding)
 * @param reg_img returns the extracted arcs in the image
 * @param reg_x width of the returned image
 * @param reg_y height of the returned image
 * @param lines all arc segments as a vector of points
 * @return edges of the image
 */
double *ParametrizedLSD(int *n_out,
                        double *img, int X, int Y, double scale,
                        int **reg_img, int *reg_x, int *reg_y, std::vector<std::vector<cv::Point2i>> & lines );

/**
 * a wrapper for lsd to work with openCV
 * @param rectangles
 * @param grey image for line extraction
 * @param scale scale ratio for the image (downscaled image may contain better result)
 * @param regions contains all the points of the arc segments
 * @return image containing arc segments
 */
cv::Mat lsd2OCV(std::vector<rectangle> & rectangles,cv::Mat & grey,double scale,std::vector<std::vector<cv::Point2i>> & regions);

#endif //ARC_SUPPORT_LSD2OCV_H
