#### File: main.c
        1   /*
        2    * File: main.c
        3    *
        4    * MATLAB Coder version            : 3.4
        5    * C/C++ source code generated on  : 27-Feb-2019 07:49:44
        6    */
        7
        8   /*************************************************************************/
        9   /* This automatically generated example C main file shows how to call    */
       10   /* entry-point functions that MATLAB Coder generated. You must customize */
       11   /* this file for your application. Do not modify this file directly.     */
       12   /* Instead, make a copy of this file, modify it, and integrate it into   */
       13   /* your development environment.                                         */
       14   /*                                                                       */
       15   /* This file initializes entry-point function arguments to a default     */
       16   /* size and value before calling the entry-point functions. It does      */
       17   /* not store or use any values returned from the entry-point functions.  */
       18   /* If necessary, it does pre-allocate memory for returned values.        */
       19   /* You can use this file as a starting point for a main function that    */
       20   /* you can deploy in your application.                                   */
       21   /*                                                                       */
       22   /* After you copy the file, and before you deploy it, you must make the  */
       23   /* following changes:                                                    */
       24   /* * For variable-size function arguments, change the example sizes to   */
       25   /* the sizes that your application requires.                             */
       26   /* * Change the example values of function arguments to the values that  */
       27   /* your application requires.                                            */
       28   /* * If the entry-point functions return values, store these values or   */
       29   /* otherwise use them as required by your application.                   */
       30   /*                                                                       */
       31   /*************************************************************************/
       32   /* Include Files */
       33   #include "rt_nonfinite.h"
       34   #include "MLS.h"
       35   #include "main.h"
       36   #include "MLS_terminate.h"
       37   #include "MLS_emxAPI.h"
       38   #include "MLS_initialize.h"
       39
       40   /* Function Declarations */
       41   static void argInit_1x2_real_T(double result[2]);
       42   static emxArray_char_T *argInit_1xUnbounded_char_T(void);
       43   static void argInit_480x640x3_uint8_T(unsigned char result[921600]);
       44   static emxArray_real_T *argInit_Unboundedx1_real_T(void);
       45   static emxArray_real_T *argInit_Unboundedx2_real_T(void);
       46   static char argInit_char_T(void);
       47   static double argInit_real_T(void);
       48   static struct0_T argInit_struct0_T(void);
       49   static unsigned char argInit_uint8_T(void);
       50   static emxArray_real_T *c_argInit_UnboundedxUnbounded_r(void);
       51   static void main_MLS(void);
       52
       53   /* Function Definitions */
       54
       55   /*
       56    * Arguments    : double result[2]
       57    * Return Type  : void
       58    */
       59   static void argInit_1x2_real_T(double result[2])
       60   {
       61     int idx1;
       62
       63     /* Loop over the array to initialize each element. */
       64     for (idx1 = 0; idx1 < 2; idx1++) {
       65       /* Set the value of the array element.
       66          Change this value to the value that the application requires. */
       67       result[idx1] = argInit_real_T();
       68     }
       69   }
       70
       71   /*
       72    * Arguments    : void
       73    * Return Type  : emxArray_char_T *
       74    */
       75   static emxArray_char_T *argInit_1xUnbounded_char_T(void)
       76   {
       77     emxArray_char_T *result;
       78     static int iv1[2] = { 1, 2 };
       79
       80     int idx1;
       81
       82     /* Set the size of the array.
       83        Change this size to the value that the application requires. */
       84     result = emxCreateND_char_T(2, iv1);
       85
       86     /* Loop over the array to initialize each element. */
       87     for (idx1 = 0; idx1 < result->size[1U]; idx1++) {
       88       /* Set the value of the array element.
       89          Change this value to the value that the application requires. */
       90       result->data[result->size[0] * idx1] = argInit_char_T();
       91     }
       92
       93     return result;
       94   }
       95
       96   /*
       97    * Arguments    : unsigned char result[921600]
       98    * Return Type  : void
       99    */
      100   static void argInit_480x640x3_uint8_T(unsigned char result[921600])
      101   {
      102     int idx0;
      103     int idx1;
      104     int idx2;
      105
      106     /* Loop over the array to initialize each element. */
      107     for (idx0 = 0; idx0 < 480; idx0++) {
      108       for (idx1 = 0; idx1 < 640; idx1++) {
      109         for (idx2 = 0; idx2 < 3; idx2++) {
      110           /* Set the value of the array element.
      111              Change this value to the value that the application requires. */
      112           result[(idx0 + 480 * idx1) + 307200 * idx2] = argInit_uint8_T();
      113         }
      114       }
      115     }
      116   }
      117
      118   /*
      119    * Arguments    : void
      120    * Return Type  : emxArray_real_T *
      121    */
      122   static emxArray_real_T *argInit_Unboundedx1_real_T(void)
      123   {
      124     emxArray_real_T *result;
      125     static int iv4[1] = { 2 };
      126
      127     int idx0;
      128
      129     /* Set the size of the array.
      130        Change this size to the value that the application requires. */
      131     result = emxCreateND_real_T(1, iv4);
      132
      133     /* Loop over the array to initialize each element. */
      134     for (idx0 = 0; idx0 < result->size[0U]; idx0++) {
      135       /* Set the value of the array element.
      136          Change this value to the value that the application requires. */
      137       result->data[idx0] = argInit_real_T();
      138     }
      139
      140     return result;
      141   }
      142
      143   /*
      144    * Arguments    : void
      145    * Return Type  : emxArray_real_T *
      146    */
      147   static emxArray_real_T *argInit_Unboundedx2_real_T(void)
      148   {
      149     emxArray_real_T *result;
      150     static int iv2[2] = { 2, 2 };
      151
      152     int idx0;
      153     int idx1;
      154
      155     /* Set the size of the array.
      156        Change this size to the value that the application requires. */
      157     result = emxCreateND_real_T(2, iv2);
      158
      159     /* Loop over the array to initialize each element. */
      160     for (idx0 = 0; idx0 < result->size[0U]; idx0++) {
      161       for (idx1 = 0; idx1 < 2; idx1++) {
      162         /* Set the value of the array element.
      163            Change this value to the value that the application requires. */
      164         result->data[idx0 + result->size[0] * idx1] = argInit_real_T();
      165       }
      166     }
      167
      168     return result;
      169   }
      170
      171   /*
      172    * Arguments    : void
      173    * Return Type  : char
      174    */
      175   static char argInit_char_T(void)
      176   {
      177     return '?';
      178   }
      179
      180   /*
      181    * Arguments    : void
      182    * Return Type  : double
      183    */
      184   static double argInit_real_T(void)
      185   {
      186     return 0.0;
      187   }
      188
      189   /*
      190    * Arguments    : void
      191    * Return Type  : struct0_T
      192    */
      193   static struct0_T argInit_struct0_T(void)
      194   {
      195     struct0_T result;
      196
      197     /* Set the value of each structure field.
      198        Change this value to the value that the application requires. */
      199     result.w_i = c_argInit_UnboundedxUnbounded_r();
      200     result.sum_w_i = argInit_Unboundedx1_real_T();
      201     result.p_ast = argInit_Unboundedx2_real_T();
      202     result.Similarity = c_argInit_UnboundedxUnbounded_r();
      203     return result;
      204   }
      205
      206   /*
      207    * Arguments    : void
      208    * Return Type  : unsigned char
      209    */
      210   static unsigned char argInit_uint8_T(void)
      211   {
      212     return 0;
      213   }
      214
      215   /*
      216    * Arguments    : void
      217    * Return Type  : emxArray_real_T *
      218    */
      219   static emxArray_real_T *c_argInit_UnboundedxUnbounded_r(void)
      220   {
      221     emxArray_real_T *result;
      222     static int iv3[2] = { 2, 2 };
      223
      224     int idx0;
      225     int idx1;
      226
      227     /* Set the size of the array.
      228        Change this size to the value that the application requires. */
      229     result = emxCreateND_real_T(2, iv3);
      230
      231     /* Loop over the array to initialize each element. */
      232     for (idx0 = 0; idx0 < result->size[0U]; idx0++) {
      233       for (idx1 = 0; idx1 < result->size[1U]; idx1++) {
      234         /* Set the value of the array element.
      235            Change this value to the value that the application requires. */
      236         result->data[idx0 + result->size[0] * idx1] = argInit_real_T();
      237       }
      238     }
      239
      240     return result;
      241   }
      242
      243   /*
      244    * Arguments    : void
      245    * Return Type  : void
      246    */
      247   static void main_MLS(void)
      248   {
      249     static unsigned char oldImg[921600];
      250     emxArray_char_T *type;
      251     double alpha;
      252     emxArray_real_T *p;
      253     emxArray_real_T *q;
      254     emxArray_real_T *v;
      255     double imgSize[2];
      256     double grid_size[2];
      257     struct0_T pre;
      258     static unsigned char newImg[921600];
      259
      260     /* Initialize function 'MLS' input arguments. */
      261     /* Initialize function input argument 'oldImg'. */
      262     argInit_480x640x3_uint8_T(oldImg);
      263
      264     /* Initialize function input argument 'type'. */
      265     type = argInit_1xUnbounded_char_T();
      266     alpha = argInit_real_T();
      267
      268     /* Initialize function input argument 'p'. */
      269     p = argInit_Unboundedx2_real_T();
      270
      271     /* Initialize function input argument 'q'. */
      272     q = argInit_Unboundedx2_real_T();
      273
      274     /* Initialize function input argument 'v'. */
      275     v = argInit_Unboundedx2_real_T();
      276
      277     /* Initialize function input argument 'imgSize'. */
      278     argInit_1x2_real_T(imgSize);
      279
      280     /* Initialize function input argument 'grid_size'. */
      281     argInit_1x2_real_T(grid_size);
      282
      283     /* Initialize function input argument 'pre'. */
      284     pre = argInit_struct0_T();
      285
      286     /* Call the entry-point 'MLS'. */
      287     MLS(oldImg, type, alpha, p, q, v, imgSize, grid_size, &pre, newImg);
      288     emxDestroy_struct0_T(pre);
      289     emxDestroyArray_real_T(v);
      290     emxDestroyArray_real_T(q);
      291     emxDestroyArray_real_T(p);
      292     emxDestroyArray_char_T(type);
      293   }
      294
      295   /*
      296    * Arguments    : int argc
      297    *                const char * const argv[]
      298    * Return Type  : int
      299    */
      300   int main(int argc, const char * const argv[])
      301   {
      302     (void)argc;
      303     (void)argv;
      304
      305     /* Initialize the application.
      306        You do not need to do this more than one time. */
      307     MLS_initialize();
      308
      309     /* Invoke the entry-point functions.
      310        You can call entry-point functions multiple times. */
      311     main_MLS();
      312
      313     /* Terminate the application.
      314        You do not need to do this more than one time. */
      315     MLS_terminate();
      316     return 0;
      317   }
      318
      319   /*
      320    * File trailer for main.c
      321    *
      322    * [EOF]
      323    */
      324