00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <cv.h>
00004 #include <cvaux.h>
00005 #include <highgui.h>
00006 #include "vapiOperationsDefault.h"
00007 #include "vapiMacro.h"
00008 #include "vapiOperationList.h"
00009 #include "vapiOperation.h"
00010 #include "vapi.h"
00011 #include "vapiAux.h"
00012 #include "vapiTypes.h"
00013 #include "vapiCameraSettings.h"
00014 #include "vapiCameraAcquisition.h"
00015 #ifndef VAPI_WITHOUT_INTERFACE
00016 #include "vapiGtkAuxWindow.h"
00017 #endif
00018 #include "ExtraOperations.h"
00019
00020 #define OperationsToAdd 28
00021
00022
00023
00024
00025
00030 void
00031 vapiAvailableEfects ()
00032 {
00033 vEffect *vapiEffect[OperationsToAdd];
00034
00035 vapiEffect[0] =
00036 vapiOperationInit ("Threshold", "Grupo1", &vapiThreshold);
00037 vapiOperationSettingsSetHasOriginalOption (vapiEffect[0]);
00038
00039 vapiOperationSettingsSetInt (vapiEffect[0],
00040 "Nivel de Binarizacao", " ", 0, 255, 128,
00041 1, vBar);
00042 vapiEffect[1] =
00043 vapiOperationInit ("GrayScale", "Grupo1", &vapiGrayscale);
00044 vapiOperationSettingsSetHasOriginalOption (vapiEffect[1]);
00045
00046 vapiEffect[2] =
00047 vapiOperationInit ("Binarizar", "Grupo1", &vapiBinarizar);
00048 vapiOperationSettingsSetHasOriginalOption (vapiEffect[2]);
00049
00050 vapiOperationSettingsSetInt (vapiEffect[2],
00051 "Nivel de Binarizacao", " ", 0, 255, 128,
00052 1, vBar);
00053
00054 vapiEffect[3] = vapiOperationInit ("Smooth", "Grupo2", &vapiSmooth);
00055 vapiOperationSettingsSetHasOriginalOption (vapiEffect[3]);
00056 vapiOperationSettingsSetRunSeveralTimes (vapiEffect[3]);
00057
00058 vapiOperationSettingsSetInt (vapiEffect[3], "Parametro 1", " ", 0,
00059 21, 3, 1, vSpin);
00060
00061
00062 vapiOperationSettingsSetInt (vapiEffect[3], "Parametro 2", " ", 0,
00063 21, 3, 1, vSpin);
00064
00065
00066 vapiOperationSettingsSetChoose (vapiEffect[3], "Tipo de Smooth",
00067 " ", 5, 3, "Blur no scale", "Blur",
00068 "Gaussian", "Mediana", "Bilateral");
00069
00070 vapiEffect[4] = vapiOperationInit ("Flip", "Grupo2", &vapiFlip);
00071
00072 vapiOperationSettingsSetInt (vapiEffect[4], "Tipo de Flip", " ",
00073 -1, 1, 0, 1, vBar);
00074 vapiOperationSettingsSetHasOriginalOption (vapiEffect[4]);
00075
00076 vapiEffect[5] = vapiOperationInit ("Sobel", "Grupo2", &vapiSobel);
00077
00078 vapiEffect[6] = vapiOperationInit ("Laplace", "Grupo2", &vapiLaplace);
00079
00080 vapiEffect[7] = vapiOperationInit ("Canny", "Grupo2", &vapiCanny);
00081
00082 vapiEffect[8] =
00083 vapiOperationInit ("Centro Geometrico", "Grupo2",
00084 &vapiGeometricCenter);
00085
00086 vapiEffect[9] = vapiOperationInit ("Erode", "Grupo2", &vapiErode);
00087 vapiOperationSettingsSetRepeatInside (vapiEffect[9]);
00088 vapiOperationSettingsSetRunSeveralTimes (vapiEffect[9]);
00089
00090
00091 vapiEffect[10] = vapiOperationInit ("Dilate", "Grupo2", &vapiDilate);
00092 vapiOperationSettingsSetRunSeveralTimes (vapiEffect[10]);
00093 vapiOperationSettingsSetRepeatInside (vapiEffect[10]);
00094
00095 vapiEffect[11]=vapiOperationInit ("Eliminar Pontos do Resultado", "Resultados",
00096 &vapiResultResetPoints);
00097
00098 vapiEffect[12] =
00099 vapiOperationInit ("Executar Tarefa", "Grupo2",
00100 &vapiLoadMacro);
00101 vapiOperationSettingsSetHasOriginalOption (vapiEffect[12]);
00102 vapiOperationSettingsSetChar (vapiEffect[12], "Nome da Tarefa", "Nome da tarefa a executar, carregada em memória");
00103
00104 vapiOperationSettingsSetMacros (vapiEffect[12], 1);
00105 vapiOperationSettingsSetBoolean
00106 (vapiEffect[12], "Guardar Sequencia de Imagens", " ", vFALSE);
00107
00108
00109 vapiEffect[13] =
00110 vapiOperationInit ("Filtro de Cor", "Grupo2",
00111 &vapiColourFilter);
00112
00113 vapiOperationSettingsSetHasOriginalOption (vapiEffect[13]);
00114 vapiOperationSettingsSetFloat (vapiEffect[13], "Hue Min", "Hue Min",
00115 0, 1, 0, 0.01, vBar);
00116
00117 vapiOperationSettingsSetFloat (vapiEffect[13], "Hue Max", " ", 0,
00118 1, 1, 0.01, vBar);
00119
00120 vapiOperationSettingsSetFloat (vapiEffect[13], "Saturation Min",
00121 " ", 0, 1, 0, 0.01, vBar);
00122
00123 vapiOperationSettingsSetFloat (vapiEffect[13], "Saturation Max",
00124 " ", 0, 1, 1, 0.01, vBar);
00125
00126 vapiOperationSettingsSetFloat (vapiEffect[13], "Value Min", " ",
00127 0, 1, 0, 0.01, vBar);
00128
00129
00130 vapiOperationSettingsSetFloat (vapiEffect[13], "Value Max", " ",
00131 0, 1, 1, 0.01, vBar);
00132
00133
00134
00135 vapiEffect[14] =
00136 vapiOperationInit ("Detectar Objecto", "Grupo2",
00137 &vapiObjectExists);
00138 vapiEffect[15] =
00139 vapiOperationInit ("Ir Para (condicional)", "Grupo2",
00140 &vapiJumpToConditional);
00141
00142
00143 vapiOperationSettingsSetInt (vapiEffect[15],
00144 "Se Verdadeiro, ir para", " ", 0, 1000,
00145 0, 1, vSpin);
00146
00147 vapiOperationSettingsSetInt (vapiEffect[15], "Se Falso, ir para",
00148 " ", 0, 1000, 0, 1, vSpin);
00149
00150 vapiEffect[16] =
00151 vapiOperationInit ("Terminar Execucao", "Grupo2",
00152 &vapiEndExecution);
00153
00154 vapiEffect[17] =
00155 vapiOperationInit ("Contagem de objectos", "Grupo2",
00156 &vapiCountObjects);
00157
00158 vapiOperationSettingsSetBoolean (vapiEffect[17],
00159 "Determinar a sua localiacao?", " ",
00160 vFALSE);
00161
00162
00163 #ifndef VAPI_WITHOUT_INTERFACE
00164
00165 vapiEffect[18] =
00166 vapiOperationInit ("Janela Informativa", "Informação",
00167 &vapiMessage);
00168 vapiOperationSettingsSetOperationBriefDescription (vapiEffect[18],
00169 "Mostra uma Janela Com informação para o utilizador");
00170 vapiOperationSettingsSetOperationLongDescription (vapiEffect[18],
00171 "Mostra uma janela com informação para o utilizador, onde é possÃvel definir variáveis de resultados. \n Exemplo: \n - %rd0 resultado inteiro da posição 0.");
00172 vapiOperationSettingsSetChar (vapiEffect[18], "Titulo da Janela",
00173 " ");
00174 vapiOperationSettingsSetChar (vapiEffect[18], "Informacao",
00175 "Informação a Mostrar ao Utilizador, que podem incluir resultados:\n - <b>%rd0</b> - Significa o resultado Inteiro (d) da posição 0");
00176
00177 vapiEffect[19] =
00178 vapiOperationInit ("Marcar Pontos Memorizados", "Grupo2",
00179 &vapiMarkPoints);
00180 vapiOperationSettingsSetHasOriginalOption (vapiEffect[19]);
00181
00182 vapiOperationSettingsSetInt (vapiEffect[19], "Vermelho no Alvo",
00183 " ", 0, 255, 255, 1, vBar);
00184
00185
00186
00187 vapiOperationSettingsSetInt (vapiEffect[19], "Verde no Alvo", " ",
00188 0, 255, 0, 1, vBar);
00189
00190
00191
00192 vapiOperationSettingsSetInt (vapiEffect[19], "Azul no Alvo", " ",
00193 0, 255, 0, 1, vBar);
00194
00195
00196
00197 vapiOperationSettingsSetInt (vapiEffect[19], "Tamanho do Alvo",
00198 " ", 0, 200, 20, 1, vBar);
00199
00200 #endif
00201 vapiEffect[20] =
00202 vapiOperationInit ("Comparar Inteiros", "Grupo2",
00203 &vapiCompareInt);
00204
00205 vapiOperationSettingsSetInt (vapiEffect[20],
00206 "Numero do Resultado", " ", 0, 1000, 0,
00207 1, vSpin);
00208 vapiOperationSettingsSetInt (vapiEffect[20], "Valor a Comparar",
00209 " ", -1000, 1000, 0, 1, vSpin);
00210
00211 vapiOperationSettingsSetChoose (vapiEffect[20], "Condicao", " ",
00212 6, 1, "Maior", "Maior ou Igual",
00213 "Igual", "Menor ou Igual", "Menor",
00214 "Diferente");
00215 vapiEffect[21] =
00216 vapiOperationInit ("Comparar Numeros Decimais", "Grupo2",
00217 &vapiCompareFloat);
00218 vapiOperationSettingsSetInt (vapiEffect[21], "Numero do Resultado",
00219 " ", 0, 1000, 0, 1, vSpin);
00220 vapiOperationSettingsSetFloat (vapiEffect[21], "Valor a Comparar",
00221 " ", -1000, 1000, 0, 0.01, vSpin);
00222
00223 vapiOperationSettingsSetChoose (vapiEffect[21], "Condicao", " ",
00224 6, 1, "Maior", "Maior ou Igual",
00225 "Igual", "Menor ou Igual", "Menor",
00226 "Diferente");
00227
00228
00229 vapiEffect[22] =
00230 vapiOperationInit ("Template Match", "Grupo2",
00231 &vapiTemplateMatch);
00232 vapiOperationSettingsSetHasOriginalOption (vapiEffect[22]);
00233 vapiOperationSettingsSetNeedOfAuxImage (vapiEffect[22], NeedTemplate);
00234
00235 vapiOperationSettingsSetFloat (vapiEffect[22],
00236 "Proximidade com o template", " ", 0,
00237 1, 0.99, 0.01, vBar);
00238
00239 vapiOperationSettingsSetBoolean
00240 (vapiEffect[22], "Guardar Localizacao dos Objectos", " ",
00241 vFALSE);
00242
00243 vapiOperationSettingsSetBoolean
00244 (vapiEffect[22], "Guardar Numero de Objectos encontrados",
00245 " ", vTRUE);
00246
00247 vapiOperationSettingsSetChar (vapiEffect[22],
00248 "Caminho para o Ficheiro", " ");
00249 vapiEffect[23] = vapiOperationInit ("OCR", "Grupo2", &vapiOCR);
00250
00251 vapiEffect[24] =
00252 vapiOperationInit ("Seleccionar Regiao de Interesse",
00253 "Grupo2", &vapiSelectRegion);
00254 vapiOperationSettingsSetNeedOfAuxImage (vapiEffect[24], NeedRegion);
00255
00256 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 1, X", " ",
00257 0, 1000, 0, 1, vSpin);
00258
00259 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 1, Y", " ",
00260 0, 1000, 0, 1, vSpin);
00261
00262 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 2, X", " ",
00263 0, 1000, 0, 1, vSpin);
00264
00265 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 2, Y", " ",
00266 0, 1000, 0, 1, vSpin);
00267
00268 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 3, X", " ",
00269 0, 1000, 0, 1, vSpin);
00270
00271 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 3, Y", " ",
00272 0, 1000, 0, 1, vSpin);
00273
00274 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 4, X", " ",
00275 0, 1000, 0, 1, vSpin);
00276
00277 vapiOperationSettingsSetInt (vapiEffect[24], "Vertice 4, Y", " ",
00278 0, 1000, 0, 1, vSpin);
00279
00280 vapiOperationSettingsSetBoolean (vapiEffect[24], "Negar Seleccao",
00281 " ", vFALSE);
00282
00283 vapiEffect[25] =
00284 vapiOperationInit ("Filtro de Pontos Isolados", "Grupo2",
00285 &vapiEraseIsolatedPixels);
00286
00287 vapiEffect[26] =
00288 vapiOperationInit ("Eliminar Inteiros do Resultado", "Resultados",
00289 &vapiResultResetInts);
00290
00291 vapiEffect[27] =
00292 vapiOperationInit ("Teste", "Testes",
00293 &vapiTeste);
00294
00295
00296
00297
00298 vapiOperationListAddOperation (vapiEffect, OperationsToAdd);
00299 }
00300
00301
00302 void
00303 vapiLoadAllOperations()
00304 {
00305 vapiAvailableEfects();
00306 vapiTimerOperations();
00307 vapiImageOperations();
00308 vapiIOOperations ();
00309 }