

#include "jv.h"
#include "tsai.h"
#include "model.h"
#include "funcoes_reta.h"


void create_img_ideal_interpretation( Model model, jvLine *ideal_interp, float w, float h ) ;

void inverseOfGrayImage( int height, int width, const unsigned char *img_rgb_in, unsigned char *img_gray_out );

int generatePairs ( jvLine *lines_in, Model mdl, jvPoint2D *pnts_line_in, jvPoint2D *pnts_line_mdl );
int correctPoints2( float *h_matrix, int np, jvPoint2D *model_pnts, jvPoint2D *model_pnts_projected );

int correctPoints( float *h_matrix, Model mdl, jvPoint2D *model_pnts_projected );

void correctLines ( float *h_matrix, Model mdl, jvLine *model_lines_projected );

void  convertPoints( int n_pnts, jvPoint2D* pnts_mdl, jvPoint2D* pnts_img, float *mdl_xs, float *mdl_ys, float *img_xs, float *img_ys, float w_window, float h_window )  ;

int razao_segmentos( jvLine *lines, int l_a, int lim_a1, int lim_a2, int lb, int lim_b1, int lim_b2, float *r ) ;

void desenha_linhas_detectadas( jvLine *linhas, int n_linhas ); 

void desenha_linhas_interpretadas( jvLine *linhas, int n_linhas );

void desenha_pontos( jvPoint2D* pnts_image, int n_p_img, jvPoint2D *pnts_corrected, int n_p_corct, jvPoint2D *pnts_built, int n_p_built ) ;