Do more. Code less. Free software for GPU computing.
<scroll to top>

image.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------//
00002 //   Copyright (c) AccelerEyes LLC. All rights reserved.                 //
00003 //   See http://www.accelereyes.com/eula for details.                    //
00004 //   This software is distributed WITHOUT ANY WARRANTY; without even     //
00005 //   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
00006 //   PURPOSE.  See the above copyright notices for more information.     //
00007 //-----------------------------------------------------------------------//
00008 
00009 #pragma once
00010 
00011 #include <cuComplex.h>
00012 #include "defines.h"
00013 
00017     typedef enum {
00018         AF_BW_Dilate = 0,
00019         AF_BW_Erode,
00020         AF_BW_Open,
00021         AF_BW_Close,
00022         AF_BW_Diag,
00023         AF_BW_Remove,
00024         AF_BW_Fill,
00025         AF_BW_Tophat,
00026         AF_BW_Bothat,
00027         AF_BW_Hbreak,
00028         AF_BW_Endpoints,
00029         AF_BW_Majority,
00030         AF_BW_Clean,
00031     } af_morph_t;
00032 
00033 
00034 namespace af {
00035 
00036     class array;
00037 
00046     AFAPI array filter(const array& image, const array& kernel);
00047 
00048 
00058     AFAPI array rotate(const array& image, const float theta, bool iscrop=true);
00059 
00060 
00068     AFAPI array erode(const array& image, const array& mask);
00069 
00070 
00078     AFAPI array dilate(const array& image, const array& mask);
00079 
00087     AFAPI array morph(const array& image, af_morph_t type);
00088 
00089 
00094     typedef enum {
00095         AF_RSZ_Nearest   =  0, 
00096         AF_RSZ_Bilinear   = 1, 
00097     } af_resize_t;
00098 
00099 
00108     AFAPI array resize(const array& image, float scale, af_resize_t type=AF_RSZ_Nearest);
00109 
00119     AFAPI array resize(const array& image, float height, float width, af_resize_t type = AF_RSZ_Nearest);
00120 
00121 
00129     AFAPI array rgbtogray(const array& image);
00130 
00131 
00139     AFAPI array histogram(const array& data, unsigned nbins);
00140 
00150     AFAPI array histogram(const array& data, unsigned nbins, float min, float max);
00151 
00152 
00160     AFAPI array histequal(const array& data, const array& histogram);
00161 
00162 
00164 
00166     typedef enum {
00167         AF_RP_Area             =  0, 
00168         AF_RP_Centroid         =  1, 
00169         AF_RP_Orientation      =  2, 
00170         AF_RP_AxisLengths      =  4, 
00171     } af_rprops_t;
00172 
00173 
00180     AFAPI array regions(const array& image, unsigned connectivity);
00181 
00182 
00188     AFAPI array areas(const array& regions);
00189 
00195     AFAPI array centroids(const array& regions);
00196 
00203     AFAPI array moments(const array& regions, af_rprops_t property);
00204 
00211     AFAPI void moments(array& areas, array& centroids, const array& regions);
00212 
00221     AFAPI void moments(array& areas, array& centroids, array& axes, array& orientations, const array& regions);
00222 
00224 
00225 
00234     AFAPI array medfilt(const array& image, const unsigned height=3, const unsigned width=3);
00235 }
00236 
00237 
00238 
00239 
00240 
00241 #ifdef __cplusplus
00242 extern "C" {
00243 #endif
00244 
00265 
00266     AFAPI afError af_filter_S(float* d_out,
00267                                    unsigned xi, unsigned yi,
00268                                    const float* d_in,
00269                                    unsigned xf, unsigned yf,
00270                                    const float* d_filter,
00271                                    unsigned type, float value,
00272                                    bool conv, bool full,
00273                                    unsigned batchA, unsigned batchF);
00274 
00276     AFAPI afError af_filter_D(double* d_out,
00277                                    unsigned xi, unsigned yi,
00278                                    const double* d_in,
00279                                    unsigned xf, unsigned yf,
00280                                    const double* d_filter,
00281                                    unsigned type, float value,
00282                                    bool conv, bool full,
00283                                    unsigned batchA, unsigned batchF);
00286 
00287 
00303 
00304     AFAPI afError af_rotate_S(float* d_out,
00305                                    unsigned xo, unsigned yo,
00306                                    const float* d_in,
00307                                    unsigned xi, unsigned yi,
00308                                    float theta, unsigned batch);
00311 
00312 
00328 
00329     AFAPI afError af_erode_S(float* d_out,
00330                                   unsigned mI, unsigned nI,
00331                                   const float* d_in,
00332                                   unsigned mH, unsigned nH,
00333                                   const float* h_nhood, unsigned batch);
00334 
00336     AFAPI afError af_erode_D(double* d_out,
00337                                   unsigned mI, unsigned nI,
00338                                   const double* d_in,
00339                                   unsigned mH, unsigned nH,
00340                                   const float* h_nhood, unsigned batch);
00343 
00344 
00360 
00361     AFAPI afError af_dilate_S(float* d_out,
00362                                    unsigned mI, unsigned nI,
00363                                    const float* d_in,
00364                                    unsigned mH, unsigned nH,
00365                                    const float* h_nhood, unsigned batch);
00366 
00368     AFAPI afError af_dilate_D(double* d_out,
00369                                    unsigned mI, unsigned nI,
00370                                    const double* d_in,
00371                                    unsigned mH, unsigned nH,
00372                                    const float* h_nhood, unsigned batch);
00375 
00376 
00391 
00392     AFAPI afError af_morph_B(bool* d_out,
00393                              unsigned mI, unsigned nI,
00394                              const bool* d_in,
00395                              af_morph_t opts , unsigned N,
00396                              unsigned batch);
00399 
00400 
00416 
00417     AFAPI afError af_resize_S(float* d_out,
00418                                    unsigned mO, unsigned nO,
00419                                    const float* d_in,
00420                                    unsigned mI, unsigned nI,
00421                                    unsigned type);
00424 
00425 
00439 
00440     AFAPI afError af_rgb2gray_S(float* d_out,
00441                                      unsigned mI, unsigned nI,
00442                                      const float* d_in, unsigned packed);
00445 
00446 
00462 
00463     AFAPI afError af_histogram_S(float* d_hist,
00464                                       unsigned length, const float* d_data,
00465                                       unsigned nbins , const float* h_bins,
00466                                       unsigned nsets, unsigned ngfor);
00469 
00470 
00471 
00488 
00489     AFAPI afError af_histminmax_S(float* d_hist,
00490                                        unsigned len, const float* d_buf,
00491                                        unsigned bins, const float* hdata,
00492                                        unsigned nDataSets, unsigned ngfor,
00493                                        float min, float max);
00496 
00497 
00512 
00513     AFAPI afError af_histequalize_S(float* d_out,
00514                                          unsigned length, const float* d_data,
00515                                          unsigned nbins , const float* d_bins);
00518 
00519 
00532 
00533     AFAPI afError af_regions_B(float* out, unsigned mI, unsigned nI,
00534                                     const bool* in,
00535                                     unsigned conn);
00538 
00539 
00556 
00557     AFAPI afError af_regionprops_S(float* out, unsigned ny, unsigned nx,
00558                                         float* L, int opt, unsigned nregions);
00561 
00562 
00563 
00575 
00576     AFAPI afError af_medfilt_B(char* d_out,
00577                                      unsigned m, unsigned n, const char* d_in,
00578                                      const unsigned* h_W);
00580     AFAPI afError af_medfilt_c(unsigned char* d_out,
00581                                      unsigned m, unsigned n, const unsigned char* d_in,
00582                                      const unsigned* h_W);
00584     AFAPI afError af_medfilt_I(int* d_out,
00585                                      unsigned m, unsigned n, const int* d_in,
00586                                      const unsigned* h_W);
00588     AFAPI afError af_medfilt_U(unsigned* d_out,
00589                                      unsigned m, unsigned n, const unsigned* d_in,
00590                                      const unsigned* h_W);
00592     AFAPI afError af_medfilt_S(float* d_out,
00593                                      unsigned m, unsigned n, const float* d_in,
00594                                      const unsigned* h_W);
00596     AFAPI afError af_medfilt_D(double* d_out,
00597                                      unsigned m, unsigned n, const double* d_in,
00598                                      const unsigned* h_W);
00601 
00602 #ifdef __cplusplus
00603 }
00604 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines