src/vapiImagesAux.c

Ir para a documentação deste ficheiro.
00001 #include <cxcore.h>
00002 #include <highgui.h>
00003 #include <stdio.h>
00004 #include "vapiTypes.h"
00005 #include "vapiImages.h"
00006 #include "vapiImagesAux.h"
00007 
00008 
00013 void
00014 vapiOriginal2Actual (vImages * Images)
00015 {
00016         Images->Actual =vapiImagesCopy(Images->Original);
00017 }
00018 
00023 IplImage *
00024 vapiImagesSameSize (IplImage * src, int n_channels)
00025 {
00026         IplImage *dst;
00027 
00028         if (n_channels == 0)
00029                 n_channels = src->nChannels;
00030 
00031         dst = cvCreateImage (cvSize (src->width,
00032                                      src->height), IPL_DEPTH_8U, n_channels);
00033         /*
00034          * por forma a não ter imagens vazias que causam problemas.
00035          */
00036         cvZero (dst);
00037         return dst;
00038 }
00039 
00047 IplImage *
00048 vapiImagesSameSize16 (IplImage * src, int n_channels)
00049 {
00050         IplImage *dst;
00051 
00052         if (n_channels == 0)
00053         {
00054                 n_channels = src->nChannels;
00055         }
00056 
00057         dst = cvCreateImage (cvSize (src->width,
00058                                      src->height), IPL_DEPTH_16S, n_channels);
00059         /*
00060          * por forma a não ter imagens vazias que causam problemas.
00061          */
00062         cvZero (dst);
00063         return (IplImage *) dst;
00064 }
00065 
00071 int
00072 vapiImagesCheckChannels (vImages * Images, int nChannels)
00073 {
00074         if (Images->Actual->nChannels != nChannels)
00075                 return 0;
00076         else
00077         {
00078                 return 1;
00079         }
00080 }
00081 
00094 void
00095 vapiImagesDrawCross (IplImage * src, int line, int column, int lenght,
00096                      int thick, int *color)
00097 {
00098         cvLine (src, cvPoint (column - lenght, line),
00099                 cvPoint (column + lenght, line), CV_RGB (color[0], color[1],
00100                                                          color[2]), thick, 1,
00101                 0);
00102         cvLine (src, cvPoint (column, line - lenght),
00103                 cvPoint (column, line + lenght), CV_RGB (color[0], color[1],
00104                                                          color[2]), thick, 1,
00105                 0);
00106 }
00107 
00112 void
00113 vapiImagesPrint (IplImage * src, double level)
00114 {
00115 
00116         int line, column;
00117         CvScalar a;
00118         for (line = 0; line < src->height; line++)
00119                 for (column = 0; column < src->height; column++)
00120                 {
00121                         a = cvGet2D (src, line, column);
00122                         if (a.val[0] > level)
00123                                 v_info (" valor %d - %d : %G \n", line,
00124                                         column, a.val[0]);
00125                 }
00126 
00127 }
00128 
00133 IplImage *
00134 vapiImagesEnlarge (IplImage * src, int enlarge)
00135 {
00136         IplImage *dst;
00137         int n_channels;
00138 
00139         n_channels = src->nChannels;
00140 
00141         dst = cvCreateImage (cvSize (src->width + enlarge,
00142                                      src->height + enlarge), IPL_DEPTH_8U,
00143                              n_channels);
00144 
00145         return dst;
00146 
00147 
00148 }
00149 
00150 
00158 void
00159 vapiImagesShow (const char *title, IplImage * image)
00160 {
00161         cvNamedWindow (title, CV_WINDOW_AUTOSIZE);
00162         cvShowImage (title, image);
00163 }
00164 
00165 IplImage *
00166 vapiImagesCopy(IplImage * src)
00167 {
00168         IplImage * tempImage;
00169         tempImage=vapiImagesSameSize(src, src->nChannels);
00170         cvCopy(src, tempImage, NULL);
00171         
00172         return tempImage;
00173         
00174 }
00175 
00176 vImages *
00177 vapiImagesAuxCloneImages(vImages * src)
00178 {
00179         vImages * Images= vImagesInit();
00180         
00181         Images->Original = vapiImagesCopy(src->Original);
00182         Images->Actual = vapiImagesCopy(src->Actual);
00183         return Images;
00184 }

Gerado em Tue Jul 24 10:34:59 2007 para Vapi por  doxygen 1.5.1