//
//  lens_correction.h
//  lens_correction
//
//  Created by Mehdi Stapleton on 2015-05-18.
//
//

#ifndef __lens_correction__
#define __lens_correction__

//Standard libraries
#include <assert.h>
#include <sstream>
#include <string>
#include <cstdio>
#include <iostream>
#include <fstream>

#include <vector>
#include <cmath>

#include "plumb_line_types.h"

//---------------------------------------------------------------
//             GENERAL PREPROCESSOR DEFINITIONS
//---------------------------------------------------------------


//---------------------------------------------------------------
//                      GLOBAL CONSTANTS
//---------------------------------------------------------------

static const uint32_t R_PLANE = 0;
static const uint32_t G_PLANE = 1;
static const uint32_t B_PLANE = 2;
static const uint32_t A_PLANE = 3;

//---------------------------------------------------------------
//                      TYPE DEFINITIONS
//---------------------------------------------------------------

typedef enum {
     RGB_IMAGE_R_PLANE = 0
    ,RGB_IMAGE_G_PLANE
    ,RGB_IMAGE_B_PLANE
    ,RGB_IMAGE_NPLANES
}RgbImageIdx;

typedef enum {
     GRAY_IMAGE_PLANE = 0
    ,GRAY_IMAGE_NPLANES
}GrayImageIdx;

//---------------------------------------------------------------
//                  IMAGE CORRECTION FUNCTIONS
//---------------------------------------------------------------

/* Apply correction model to an input 'distorted' image
 
   >blind correction: computes distorted coordinates given uniform grid of nominal correct coordinates,
                      and uses interpolation for sub-pixel accuracy.

 */

void blind_image_correction(const matrix_t* pDisImg, matrix_t* const pCorrImg, const coef_t* pCoefs, const vector_t* pScale, const vector_t* pOffset, uint32_t nRows, uint32_t nCols, uint32_t nComps);




#endif /* defined(__lens_correction__) */
