#include <stdio.h>
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
#include <cvaux.h>
#include "vapiCameraAcquisition.h"
#include "vapiAux.h"
#include "vapiImagesAux.h"
#include "vapiGtkAux.h"
#include "vapi.h"
#include "vapiTypes.h"
#include "vapiOperationsDefault.h"
#include "vapiCameraSettings.h"
#include "vapiGtkInterface.h"
Diagrama de dependências de inclusão para vapiCameraAcquisition.c:
Ir para o código fonte deste ficheiro.
Funções | |
void | vapiCameraAcquisitionLoadingStatus (const char *Message, double steps) |
Informs about the Progress of the image Acquisition. | |
int | vapiGetHowManyCameras () |
Automatically check how many Cameras are available for the application. | |
int | vapiGetSnapshot (vImages *Images, vCameraSettings *CameraSettings) |
Get Snapshot from the source. | |
int | vapiGetSnapshotLocalCamera (vImages *Images, vCameraSettings *CameraSettings) |
int | vapiGetSnapshotLocalFile (vImages *Images, vCameraSettings *CameraSettings) |
Variáveis | |
static double | NUMBER_OF_ACQUISITION_STEPS |
void vapiCameraAcquisitionLoadingStatus | ( | const char * | Message, | |
double | steps | |||
) |
Informs about the Progress of the image Acquisition.
Message | Description of the Action that is ocorring | |
steps | Percentage in relation to all acuisition steps 1/(total of steps) |
Definido na linha 204 do ficheiro vapiCameraAcquisition.c.
Referências HaveAcquisitionLoadingProgress, MainLoadDone, vapi_loading_progress_main_steps() e vapi_loading_progress_step().
Referenciado por vapiGetSnapshot(), vapiGetSnapshotLocalCamera() e vapiGetSnapshotLocalFile().
00205 { 00206 extern vBoolean MainLoadDone; 00207 extern vBoolean HaveAcquisitionLoadingProgress; 00208 00209 if (MainLoadDone && HaveAcquisitionLoadingProgress) 00210 { 00211 vapi_loading_progress_step (Message, steps); 00212 } 00213 00214 if (!MainLoadDone) 00215 { 00216 00217 vapi_loading_progress_main_steps (Message, steps); 00218 } 00219 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
int vapiGetHowManyCameras | ( | ) |
Automatically check how many Cameras are available for the application.
Definido na linha 167 do ficheiro vapiCameraAcquisition.c.
00168 { 00169 00170 IplImage *frame; 00171 CvCapture *capture; 00172 int i = 0; 00173 00174 for (;;) 00175 { 00176 00177 //capture init 00178 capture = cvCaptureFromCAM (i); 00179 00180 00181 if (!cvGrabFrame (capture)) 00182 { 00183 cvReleaseCapture (&capture); 00184 return i; 00185 } 00186 00187 //Grab frame 00188 frame = cvRetrieveFrame (capture); 00189 00190 if (!frame) 00191 { 00192 cvReleaseCapture (&capture); 00193 cvReleaseImage (&frame); 00194 return i; 00195 } 00196 cvReleaseCapture (&capture); 00197 00198 ++i; 00199 } 00200 }
int vapiGetSnapshot | ( | vImages * | Images, | |
vCameraSettings * | CameraSettings | |||
) |
Get Snapshot from the source.
Images | Destination Image Handler | |
CameraSettings | The source Settings |
Definido na linha 119 do ficheiro vapiCameraAcquisition.c.
Referências _vCameraSettings::CameraType, HaveAcquisitionLoadingProgress, MainLoadDone, NUMBER_OF_ACQUISITION_STEPS, _vImages::Original, vapi_loading_progress_reset(), vapiCameraAcquisitionLoadingStatus(), vapiGetSnapshotLocalCamera(), vapiGetSnapshotLocalFile(), vCameraLocal, vCameraLocalFile e vFALSE.
Referenciado por main(), vapiGtkCbLoadStaticImage(), vapiGtkSetOriginWindowTestSaveOrigin(), vapiOriginal() e vapiRefreshImage().
00120 { 00121 int CameraERROR = 1; 00122 extern vBoolean HaveAcquisitionLoadingProgress; 00123 extern double NUMBER_OF_ACQUISITION_STEPS; 00124 00125 if (MainLoadDone && HaveAcquisitionLoadingProgress) 00126 { 00127 vapi_loading_progress_reset (); 00128 } 00129 00130 switch (CameraSettings->CameraType) 00131 { 00132 case vCameraLocal: 00133 { 00134 NUMBER_OF_ACQUISITION_STEPS = 3; 00135 CameraERROR = 00136 vapiGetSnapshotLocalCamera (Images, CameraSettings); 00137 break; 00138 } 00139 case vCameraLocalFile: 00140 { 00141 NUMBER_OF_ACQUISITION_STEPS = 2; 00142 CameraERROR = 00143 vapiGetSnapshotLocalFile (Images, CameraSettings); 00144 00145 } 00146 } 00147 if (CameraERROR) 00148 { 00149 NUMBER_OF_ACQUISITION_STEPS = 2; 00150 vapiCameraAcquisitionLoadingStatus 00151 ("Erro a Carregar Imagem", 1.0 / 00152 NUMBER_OF_ACQUISITION_STEPS); 00153 Images->Original = 00154 cvLoadImage ("pixmaps/vapiErroDeCamara.png", 3); 00155 } 00156 00157 vapiCameraAcquisitionLoadingStatus 00158 ("Captura Terminada", (1.0 / NUMBER_OF_ACQUISITION_STEPS)); 00159 00160 HaveAcquisitionLoadingProgress = vFALSE; 00161 00162 return CameraERROR; 00163 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
int vapiGetSnapshotLocalCamera | ( | vImages * | Images, | |
vCameraSettings * | CameraSettings | |||
) |
Definido na linha 21 do ficheiro vapiCameraAcquisition.c.
Referências _vCameraSettings::LocalCameraFirstCapture, NUMBER_OF_ACQUISITION_STEPS, _vImages::Original, v_debug, vapiCameraAcquisitionLoadingStatus(), vapiCameraSettingsGetCapture(), vapiCameraSettingsGetLocalCameraNumber(), vapiCameraSettingsSetCapture(), vapiCameraSettingsSetNoCapture() e vapiImagesSameSize().
Referenciado por vapiGetSnapshot().
00023 { 00024 00025 IplImage *frame; 00026 int camera; 00027 00028 v_debug ("Inicio de Captura com Câmara Local "); 00029 00030 camera = vapiCameraSettingsGetLocalCameraNumber (CameraSettings); 00031 00032 if (camera == -2) 00033 { 00034 v_debug ("Saiu Com Erro "); 00035 00036 return 1; 00037 } 00038 00039 vapiCameraAcquisitionLoadingStatus ("A iniciar Câmara", 00040 (1.0 / 00041 NUMBER_OF_ACQUISITION_STEPS)); 00042 00043 if (CameraSettings->LocalCameraFirstCapture) 00044 { 00045 v_debug ("Primeira Captura"); 00046 00047 vapiCameraSettingsSetCapture (CameraSettings, 00048 cvCaptureFromCAM (camera)); 00049 } 00050 00051 00052 if (!cvGrabFrame (vapiCameraSettingsGetCapture (CameraSettings))) 00053 { 00054 vapiCameraSettingsSetNoCapture (CameraSettings); 00055 return 1; 00056 } 00057 v_debug ("Vai descarregar a frame da Câmara"); 00058 00059 //Grab frame 00060 vapiCameraAcquisitionLoadingStatus ("A Descarregar a Frame", 00061 (1.0 / 00062 NUMBER_OF_ACQUISITION_STEPS)); 00063 00064 frame = cvRetrieveFrame (vapiCameraSettingsGetCapture 00065 (CameraSettings)); 00066 v_debug ("já tem a frame"); 00067 00068 if (!frame) 00069 { 00070 vapiCameraSettingsSetNoCapture (CameraSettings); 00071 cvReleaseImage (&frame); 00072 return 1; 00073 } 00074 00075 //Copy frame 00076 00077 v_debug ("Tem a Frame, vai converter na imagem "); 00078 00079 Images->Original = vapiImagesSameSize (frame, frame->nChannels); 00080 00081 //check if frame is upside down 00082 if (frame->origin == IPL_ORIGIN_TL) 00083 { 00084 cvCopy (frame, Images->Original, NULL); 00085 } 00086 else 00087 { 00088 cvFlip (frame, Images->Original, 0); 00089 } 00090 //cvReleaseImage(&frame); 00091 00092 return 0; 00093 00094 00095 00096 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
int vapiGetSnapshotLocalFile | ( | vImages * | Images, | |
vCameraSettings * | CameraSettings | |||
) |
Definido na linha 99 do ficheiro vapiCameraAcquisition.c.
Referências _vCameraSettings::LocalFileName, NUMBER_OF_ACQUISITION_STEPS, _vImages::Original, vapiCameraAcquisitionLoadingStatus(), vapiCameraSettingsGetLocalFilename() e vapiFileIsReadable().
Referenciado por vapiGetSnapshot().
00100 { 00101 00102 char *FileName; 00103 00104 vapiCameraAcquisitionLoadingStatus ("A abrir o Ficheiro", (1.0 / 00105 NUMBER_OF_ACQUISITION_STEPS)); 00106 00107 FileName = vapiCameraSettingsGetLocalFilename (CameraSettings); 00108 if (FileName == NULL 00109 || !vapiFileIsReadable (CameraSettings->LocalFileName)) 00110 { 00111 return 1; 00112 } 00113 Images->Original = cvLoadImage (FileName, 3); 00114 00115 return 0; 00116 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
double NUMBER_OF_ACQUISITION_STEPS [static] |
Definido na linha 18 do ficheiro vapiCameraAcquisition.c.
Referenciado por vapiGetSnapshot(), vapiGetSnapshotLocalCamera() e vapiGetSnapshotLocalFile().