#include <stdio.h>
#include "vapiTypes.h"
#include "vapi.h"
#include "vapiAux.h"
#include "vapiString.h"
#include "vapiImagesAux.h"
#include "vapiMacro.h"
#include "vapiOperationList.h"
#include "vapiOperationOptions.h"
#include "vapiCameraCalibrate.h"
#include "vapiGtkAuxWindow.h"
Diagrama de dependências de inclusão para vapiCameraCalibrate.c:
Ir para o código fonte deste ficheiro.
Funções | |
void | v3OptionsFree (vapi3Options *Options) |
vapi3Options * | vapi3OptionsInit () |
void | vapiCalibrateCameraCreateMacro (vOperationList *OperationList, vMacro *Macro, vapi3Options *Options, vBoolean CalculateConstant) |
Função que cria uma macro para efectuar a calibração da câmara. | |
vapiCalibrateCameraReturn * | vapiCalibrateCameraGetConstant (vOperationList *OperationList, vImages *Images, vapi3Options *OptionsA, vapi3Options *OptionsB, double distanceRealA, double distanceRealB, vBoolean CalculateConstant) |
void | vCalibrateCamerReturnFree (vapiCalibrateCameraReturn *calibrateReturn) |
void v3OptionsFree | ( | vapi3Options * | Options | ) |
Definido na linha 272 do ficheiro vapiCameraCalibrate.c.
Referenciado por vapiGtkWindowCalibrateCameraGetImages().
Here is the caller graph for this function:
vapi3Options* vapi3OptionsInit | ( | ) |
Definido na linha 265 do ficheiro vapiCameraCalibrate.c.
Referenciado por vapiCalibrateCameraGetColourAOptions() e vapiCalibrateCameraGetColourBOptions().
00266 { 00267 vapi3Options *Options = malloc (sizeof (vapi3Options)); 00268 return Options; 00269 }
Here is the caller graph for this function:
void vapiCalibrateCameraCreateMacro | ( | vOperationList * | OperationList, | |
vMacro * | Macro, | |||
vapi3Options * | Options, | |||
vBoolean | CalculateConstant | |||
) |
Função que cria uma macro para efectuar a calibração da câmara.
vapiCalibrateCameraCreateMacro (vOperationList * OperationList, vMacro * Macro, vOptions * Options)
Definido na linha 25 do ficheiro vapiCameraCalibrate.c.
Referências _vOptions::booleans, _vOptions::CustomOptions, _vOptions::ints, OperationList, _vapi3Options::Option0, _vapi3Options::Option1, _vapi3Options::Option2, vapiMacroAddItem(), vapiOperationListSelectOperation() e vapiOperationOptionsInit().
Referenciado por vapiCalibrateCameraGetConstant().
00028 { 00029 vEffect *tempOperation; 00030 vOptions *tempOptions; 00031 00032 /* 00033 * Filtro de Cor 00034 */ 00035 tempOperation = vapiOperationListSelectOperation 00036 (OperationList, "Filtro de Cor"); 00037 00038 vapiMacroAddItem (Macro, tempOperation, Options->Option0); 00039 00040 /* 00041 * Binarizar 00042 */ 00043 tempOperation = vapiOperationListSelectOperation 00044 (OperationList, "Binarizar"); 00045 00046 tempOptions = vapiOperationOptionsInit (tempOperation); 00047 tempOptions->ints[0] = 0; 00048 00049 vapiMacroAddItem (Macro, tempOperation, tempOptions); 00050 00051 /* 00052 * Filtro de Pontos isolados 00053 */ 00054 tempOperation = vapiOperationListSelectOperation 00055 (OperationList, "Filtro de Pontos Isolados"); 00056 00057 tempOptions = vapiOperationOptionsInit (tempOperation); 00058 00059 vapiMacroAddItem (Macro, tempOperation, tempOptions); 00060 //vOptionsFree(tempOptions, tempOperation); 00061 /* 00062 * Erode 00063 */ 00064 if (((vEffectOptions *) Options->Option1->CustomOptions)->times != 0) 00065 { 00066 tempOperation = vapiOperationListSelectOperation 00067 (OperationList, "Erode"); 00068 00069 vapiMacroAddItem (Macro, tempOperation, Options->Option1); 00070 } 00071 /* 00072 * Dilate 00073 */ 00074 if (((vEffectOptions *) Options->Option2->CustomOptions)->times != 0) 00075 { 00076 tempOperation = vapiOperationListSelectOperation 00077 (OperationList, "Dilate"); 00078 00079 vapiMacroAddItem (Macro, tempOperation, Options->Option2); 00080 } 00081 /* 00082 * Centro Geométrico 00083 */ 00084 tempOperation = vapiOperationListSelectOperation 00085 (OperationList, "Contagem de objectos"); 00086 tempOptions = vapiOperationOptionsInit (tempOperation); 00087 /* 00088 * Se não vamos calcular a constante, não vale a pena detectar pontos. 00089 * Esta é uma maneira de prevenir durante testes que se encontrem 00090 * milhares de pontos. 00091 */ 00092 tempOptions->booleans[0] = CalculateConstant; 00093 00094 vapiMacroAddItem (Macro, tempOperation, tempOptions); 00095 00096 00097 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
vapiCalibrateCameraReturn* vapiCalibrateCameraGetConstant | ( | vOperationList * | OperationList, | |
vImages * | Images, | |||
vapi3Options * | OptionsA, | |||
vapi3Options * | OptionsB, | |||
double | distanceRealA, | |||
double | distanceRealB, | |||
vBoolean | CalculateConstant | |||
) |
Definido na linha 102 do ficheiro vapiCameraCalibrate.c.
Referências _vImages::Actual, _vapiCalibrateCameraReturn::constant, _vapiCalibrateCameraReturn::imResultA, _vapiCalibrateCameraReturn::imResultB, _vMacroHeader::Macro, OperationList, _vMacroResult::points, _vMacroResult::pointsNumber, _vMacroHeader::PreviousResult, v_debug, v_info(), vapiApplyMacro(), vapiCalibrateCameraCreateMacro(), vapiMacroDelete(), vapiMacroNew(), vapiMacroResultInit(), vapiOriginal2Actual(), vFALSE, vImagesFreeActual() e vResultFree().
Referenciado por vapiGtkWindowCalibrateCameraGetImages().
00108 { 00109 vMacroHeader *MacroA = vapiMacroNew ("A"); 00110 vMacroHeader *MacroB = vapiMacroNew ("B"); 00111 vMacroResult *ResultA, *ResultB; 00112 vapiCalibrateCameraReturn *OutResults = 00113 malloc (sizeof (vapiCalibrateCameraReturn)); 00114 int distanceImageA1, distanceImageA2, distanceImageA; 00115 int distanceImageB1, distanceImageB2, distanceImageB; 00116 double kA, kB, k; 00117 00118 ResultA = vapiMacroResultInit (); 00119 ResultB = vapiMacroResultInit (); 00120 00121 /* 00122 * Criar Macro 00123 */ 00124 vapiCalibrateCameraCreateMacro (OperationList, 00125 MacroA->Macro, OptionsA, 00126 CalculateConstant); 00127 vapiCalibrateCameraCreateMacro (OperationList, 00128 MacroB->Macro, OptionsB, 00129 CalculateConstant); 00130 /* 00131 * Executar Tarefas, colocar sempre a original. 00132 */ 00133 vImagesFreeActual (Images); 00134 vapiOriginal2Actual (Images); 00135 vapiApplyMacro (MacroA, Images, vFALSE, vFALSE); 00136 OutResults->imResultA = Images->Actual; 00137 vapiOriginal2Actual (Images); 00138 vapiApplyMacro (MacroB, Images, vFALSE, vFALSE); 00139 OutResults->imResultB = Images->Actual; 00140 vapiOriginal2Actual (Images); 00141 /* 00142 * calcular as distâncias, em Pixeis. 00143 */ 00144 if (!CalculateConstant) 00145 { 00146 goto FreeAndReturn; 00147 } 00148 /* 00149 * Verificar que temos 2 pontos em cada Resultado. 00150 */ 00151 if (MacroA->PreviousResult->pointsNumber != 2) 00152 { 00153 v_info ("CalibrateCamera: Numero de Pontos no resultado A diferente de 2"); 00154 goto FreeAndReturn; 00155 } 00156 if (MacroB->PreviousResult->pointsNumber != 2) 00157 { 00158 v_info ("CalibrateCamera: Numero de Pontos no resultado B diferente de 2"); 00159 goto FreeAndReturn; 00160 } 00161 /* 00162 * Par A. 00163 */ 00164 distanceImageA1 = 00165 MacroA->PreviousResult->points[0].x - 00166 MacroA->PreviousResult->points[1].x; 00167 if (distanceImageA1 < 0) 00168 { 00169 distanceImageA1 = distanceImageA1 * (-1); 00170 } 00171 distanceImageA2 = 00172 MacroA->PreviousResult->points[0].y - 00173 MacroA->PreviousResult->points[1].y; 00174 if (distanceImageA2 < 0) 00175 { 00176 distanceImageA2 = distanceImageA2 * (-1); 00177 } 00178 00179 v_debug ("distanceA %d, %d", distanceImageA1, distanceImageA2); 00180 00181 if (distanceImageA2 > distanceImageA1) 00182 { 00183 distanceImageA = distanceImageA2; 00184 } 00185 else 00186 { 00187 distanceImageA = distanceImageA1; 00188 } 00189 /* 00190 * Par B. 00191 */ 00192 distanceImageB1 = 00193 MacroB->PreviousResult->points[0].x - 00194 MacroB->PreviousResult->points[1].x; 00195 if (distanceImageB1 < 0) 00196 { 00197 distanceImageB1 = distanceImageB1 * (-1); 00198 } 00199 distanceImageB2 = 00200 MacroB->PreviousResult->points[0].y - 00201 MacroB->PreviousResult->points[1].y; 00202 if (distanceImageB2 < 0) 00203 { 00204 distanceImageB2 = distanceImageB2 * (-1); 00205 } 00206 00207 v_debug ("distanceB %d, %d", distanceImageB1, distanceImageB2); 00208 00209 if (distanceImageB2 > distanceImageB1) 00210 { 00211 distanceImageB = distanceImageB2; 00212 } 00213 else 00214 { 00215 distanceImageB = distanceImageB1; 00216 } 00217 00218 v_debug ("distancia A: %d , distancia B: %d", distanceImageA, 00219 distanceImageB); 00220 00221 /* 00222 * Calcular Constantes e constante média 00223 */ 00224 if (!(distanceRealA > 0) || !(distanceRealB > 0)) 00225 { 00226 goto FreeAndReturn; 00227 } 00228 00229 v_debug ("distancia Real A: %1.2f , distancia Real B: %1.2f", 00230 distanceRealA, distanceRealB); 00231 00232 /* 00233 * Cor A. 00234 */ 00235 kA = distanceImageA / distanceRealA; 00236 /* 00237 * Cor B. 00238 */ 00239 kB = distanceImageB / distanceRealB; 00240 00241 v_debug ("valor da constante kA %1.2f e kB %1.2f", kA, kB); 00242 00243 /* 00244 * Média. 00245 */ 00246 00247 k = (kB + kA) / 2; 00248 00249 v_debug ("valor da constante %1.2f", k); 00250 00251 OutResults->constant = k; 00252 /* 00253 * Libertar Espaço e encerrar função. 00254 */ 00255 00256 FreeAndReturn: 00257 vapiMacroDelete (MacroA); 00258 vapiMacroDelete (MacroB); 00259 vResultFree (ResultA); 00260 vResultFree (ResultB); 00261 return OutResults; 00262 }
Grafo de chamadas desta função:
Here is the caller graph for this function:
void vCalibrateCamerReturnFree | ( | vapiCalibrateCameraReturn * | calibrateReturn | ) |
Definido na linha 278 do ficheiro vapiCameraCalibrate.c.
Referências _vapiCalibrateCameraReturn::imResultA e _vapiCalibrateCameraReturn::imResultB.
Referenciado por vapiGtkWindowCalibrateCameraGetImages().
00279 { 00280 cvReleaseImage (&calibrateReturn->imResultA); 00281 cvReleaseImage (&calibrateReturn->imResultB); 00282 free (calibrateReturn); 00283 }
Here is the caller graph for this function: