Home
TFMDSMAnexo 3.Manual de programadorRuo
Contents
1. 21 Ilustraci n 26 Conexi n con Raspberry Pi 22 llustraci n 27 VNC VIewer u li ona dada 23 Ilustraci n 28 Directorio por defecto 24 llustraci n 29 Configuraci n ccmake enne eene nnne nennt a 26 llustraci n 30 Directorio opt vc nennen nnne nennen nana terns 27 Ilustraci n 31 CMakeLists txt NN 28 llustraci n 32 Rutas include teeth treno ces i PS a SA 29 ll stracion 33 Tama o atchi VO decent dd ce cete eer ia een etg de Eden 29 Ilustraci n 34 static void encoder_buffer_callback 29 Ilustraci n 35 Eliminar vista previa 30 Ilustraci n 36 Captura de Imagen ZS uw nennen nennen nennen nennt niin nina rasan qupa 30 Ilustraci n 37 Ejemplo CaptUra scies ooo Rer En Y HERR 31 Ilustraci n 38 Ipllmage amp Mat ejemplo 32 Configuraci n Raspberry Pi 4 1 Recursos necesarios Para modificar y dar soporte a este proyecto se necesitan recursos hardw
2. Deserializes this object from a given cv FileStorage void load const FileStorage amp node Destructor LDA Compute the discriminants for data in src and labels void compute InputArrayOfArrays src InputArray labels Projects samples into the LDA subspace Mat project InputArray src Reconstructs projections from the LDA subspace Mat reconstruct InputArray src Returns the eigenvectors of this LDA Configuraci n Raspberry Pi 64 Mat eigenvectors const return _eigenvectors Returns the eigenvalues of this LDA Mat eigenvalues const return _eigenvalues static Mat subspaceProject InputArray W InputArray mean InputArray src static Mat subspaceReconstruct InputArray W InputArray mean InputArray src protected bool _dataAsRow int _num_components Mat _eigenvectors Mat _eigenvalues void lda InputArrayOfArrays src InputArray labels Singular Value Decomposition class The class is used to compute Singular Value Decomposition of a floating point matrix and then use it to solve least square problems under determined linear systems invert matrices compute condition numbers etc For a bit faster operation you can pass flags SVD MODIFY_A to modify the decomposed matrix when it is not necessarily to preserve it If you want to compute condition number of a matrix or absolute value of its determinant you do not need SVD u or SVD vt so you c
3. 54 55 56 57 58 59 60 61 66 67 68 69 70 71 72 79 COLOR LBGR2Lab COLOR LRGB2Lab COLOR LBGR2Luv COLOR LRGB2Luv COLOR Lab2LBGR COLOR Lab2LRGB COLOR Luv2LBGR COLOR Luv2LRGB COLOR BGR2YUV COLOR RGB2YUV COLOR YUV2BGR COLOR YUV2RGB 74 75 76 77 78 79 80 81 82 83 84 85 YUV 4 2 0 family to RGB COLOR YUV2RGB NV12 COLOR YUV2BGR NV12 COLOR YUV2RGB NV21 COLOR YUV2BGR NV21 COLOR YUV420sp2RGB COLOR YUV420sp2BGR COLOR YUV2RGBA NV12 COLOR YUV2BGRA NV12 COLOR YUV2RGBA NV21 COLOR YUV2BGRA NV21 COLOR YUV420sp2RGBA COLOR YUV420sp2BGRA COLOR YUV2RGB YV12 COLOR YUV2BGR YV12 COLOR YUV2RGB IYUV COLOR YUV2BGR IYUV COLOR YUV2RGB 1420 COLOR YUV2BGR 1420 COLOR YUV420p2RGB COLOR YUV420p2BGR COLOR YUV2RGBA YV12 COLOR YUV2BGRA YV12 COLOR YUV2RGBA IYUV COLOR YUV2BGRA IYUV COLOR YUV2RGBA 1420 COLOR YUV2BGRA 1420 COLOR YUV2RGBA YV12 COLOR YUV420p2RGBA COLOR YUV420p2BGRA COLOR YUV2GRAY 420 COLOR YUV2GRAY YV12 COLOR YUV2GRAY IYUV COLOR YUV2GRAY 1420 Configuraci n Raspberry Pi 90 91 92 93 COLOR YUV2RGB NV21 COLOR YUV2BGR NV21 94 95 96 97 COLOR YUV2RGBA NV21 COLOR YUV2BGRA NV21 98 99 100 101 COLOR YUV2RGB IYUV COLOR YUV2BGR IYUV COLOR YUV2RGB YV12 COLOR YUV2BGR YV12 102 103 104 105 COLOR YUV2RGBA IYUV COLOR YUV2BGRA IYUV COLOR YUV2BGRA YV12 106 COLOR YUV2GRAY
4. int PiCapture width 0 int PiCapture height 0 MMAL POOL T PiCapture camera video port pool NULL Mat PiCapture image Mat static void color callback MMAL PORT T port MMAL BUFFER HEADER T buffer MMAL BUFFER HEADER T new buffer mmal buffer header mem lock buffer unsigned char pointer unsigned char buffer gt data PiCapture set image Mat PiCapture height PiCapture width CV 8UC3 pointer mmal buffer header release buffer if port gt is enabled MMAL STATUS T status new buffer mmal queue get PiCapture camera video port pool queue if new buffer status mmal port send buffer port new buffer if new buffer status MMAL SUCCESS printf Unable to return a buffer to the video portin static void gray_callback MMAL_PORT_T port MMAL_BUFFER_HEADER_T buffer MMAL_BUFFER_HEADER_T new_buffer mmal_buffer_header_mem_lock buffer unsigned char pointer unsigned char buffer gt data PiCapture set_image Mat PiCapture height PiCapture width CV_8UC1 pointer mmal_buffer_header_release buffer if port gt is_enabled MMAL_STATUS_T status Configuraci n Raspberry Pi 39 new_buffer gt queue if new_buffer status mmal_port_send_buffer port new_buffer if new_buffer status MMAL_SUCCESS printf Unable to return a buffer to the video portin mmal queue get PiCapture camera video port pool PiCapture PiC
5. CV_EXPORTS void loadWindowParameters const String amp windowName CV_EXPORTS int startLoop int pt2Func int argc char argv int argc char argv CV_EXPORTS void stopLoop CV_EXPORTS int createButton const String amp bar_name ButtonCallback on_change void userdata 0 int type QT PUSH BUTTON bool initial_button_state false y cv endif Configuraci n Raspberry Pi 51 8 3 2 Core hpp Es un m dulo compacto que define las estructuras de datos b sicas incluyendo las matrices tipo Mat densas y multidimensionales y otras funciones b sicas utilizadas por todos los dem s m dulos C digo ifndef _ OPENCV CORE HPP _ define __OPENCV_CORE_HPP__ ifndef _ cplusplus error core hpp header must be compiled as C endif include opencv2 core cvdef h include opencv2 core version hpp include opencv2 core base hpp include opencv2 core cvstd hpp include opencv2 core traits hpp include opencv2 core matx hpp include opencv2 core types hpp include opencv2 core mat hpp include opencv2 core persistence hpp namespace cv Namespace where all the C OpenCV functionality resides 7 namespace cv The standard OpenCV exception class Instances of the class are thrown by various functions and methods in the case of critical errors El class CV EXPORTS Exception public std exception public DU Default constructor Exception fa Full constructor Nor
6. reverses the order of the rows columns or both in a matrix CV_EXPORTS_W void flip InputArray src OutputArray dst int flipCode replicates the input matrix the specified number of times in the horizontal and or vertical direction CV_EXPORTS_W void repeat InputArray src int ny int nx OutputArray dst CV_EXPORTS Mat repeat const Mat amp src int ny int nx CV_EXPORTS void hconcat const Mat src size_t nsrc OutputArray dst CV_EXPORTS void hconcat InputArray srcl InputArray src2 OutputArray dst CV_EXPORTS_W void hconcat InputArrayOfArrays src OutputArray dst CV_EXPORTS void vconcat const Matt src size_t nsrc OutputArray dst CV_EXPORTS void vconcat InputArray srcl InputArray src2 OutputArray dst CV_EXPORTS_W void vconcat InputArrayOfArrays src OutputArray dst computes bitwise conjunction of the two arrays dst srcl amp src2 CV EXPORTS void bitwise_and InputArray srcl InputArray src2 OutputArray dst InputArray mask noArray Configuraci n Raspberry Pi 57 computes bitwise disjunction of the two arrays dst src1 src2 CV EXPORTS void bitwise or InputArray srcl InputArray src2 OutputArray dst InputArray mask noArray computes bitwise exclusive or of the two arrays dst srcl src2 CV EXPORTS void bitwise xor InputArray srcl InputArray src2 OutputArray dst InputArray mask noArray inverts each bit of array dst src CV EXPORTS W void bitwise not
7. 117 118 COLOR YUV2RGB YUY2 COLOR YUV2BGR YUY2 COLOR YUV2RGB YUY2 COLOR YUV2BGR YUY2 119 120 121 122 COLOR YUV2RGBA YUY2 COLOR YUV2BGRA YUY2 COLOR YUV2RGBA YUY2 COLOR YUV2BGRA YUY2 123 124 CV YUV2GRAY UYVY COLOR YUV2GRAY UYVY COLOR YUV2GRAY UYVY COLOR YUV2GRAY YUY2 COLOR YUV2GRAY YUY2 COLOR YUV2GRAY YUY2 cation 125 126 family 81 COLOR RGB2YUV 1420 COLOR BGR2YUV 1420 COLOR RGB2YUV IYUV COLOR BGR2YUV IYUV COLOR RGBA2YUV 1420 COLOR BGRA2YUV 1420 COLOR RGBA2YUV IYUV COLOR BGRA2YUV IYUV COLOR RGB2YUV YV12 COLOR BGR2YUV YV12 COLOR RGBA2YUV YV12 COLOR BGRA2YUV YV12 Demosaicing COLOR BayerBG2BGR 4 COLOR BayerGB2BGR 4 COLOR BayerRG2BGR 4 COLOR BayerGR2BGR 4 127 128 COLOR RGB2YUV 1420 COLOR BGR2YUV 1420 129 130 COLOR RGBA2YUV 1420 COLOR BGRA2YUV 1420 131 132 133 134 6 7 8 9 COLOR BayerBG2RGB COLOR_BayerRG2BGR COLOR BayerGB2RGB COLOR_BayerGR2BGR COLOR BayerRG2RGB COLOR_BayerBG2BGR COLOR BayerGR2RGB COLOR_BayerGB2BGR COLOR BayerBG2GRAY 86 COLOR BayerGB2GRAY 87 COLOR BayerRG2GRAY 88 COLOR BayerGR2GRAY 89 Demosaicing using Variable Number of Gradients COLOR BayerBG2BGR VNG 62 COLOR BayerGB2BGR VNG 63 COLOR BayerRG2BGR VNG 64 COLOR BayerGR2BGR VNG 65 COLOR BayerBG2RGB VNG COLOR BayerRG2BGR VNG COLOR BayerGB2RGB VNG COLOR BayerGR2BGR VNG
8. 13 Ilustraci n 12 Habilitar RaspiCam 13 Ilustraci n 13 Overcg ogk LL dead 13 Ilustraci n 14 Opciones avanzadas 14 Ilustraci n 15 LEDs conexi n de 15 Ilustraci n 16 IP Raspberry Pi 16 Ilustraci n 17 Conexi n entre ordenador y Raspberry Pi 16 Ilustraci n 18 Conexiones iii n Eu EC E ERE idas 17 llustraci n 19 Direcci n est tica Pe III III eene eene nennen nnns ener 18 Ilustraci n 20 Direcci n est tica Raspberry Pi 19 Ilustraci n 21 Comprobaci n configuraci n 19 Ilustraci n 22 Servicio SSH RASPi cceccessssceccessssseeeeccescseeeeeecceeeseeeeeeeceeeeeeeaeeeeseseeeeaeeeeeeeeeeaaeeeenss 20 Configuraci n Raspberry Pi 3 llustraci n 23 PULLEY ds a 20 Ilustraci n 24 Par metros Putty rinena a as au uw 21 Ilustraci n 25 Configuraci n Putty con IP RasPi
9. COLOR BayerRG2RGB VNG COLOR BayerBG2BGR VNG COLOR BayerGR2RGB VNG COLOR BayerGB2BGR VNG Edge Aware Demosaicing COLOR BayerBG2BGR EA 135 COLOR BayerGB2BGR EA 136 COLOR BayerRG2BGR EA 137 COLOR BayerGR2BGR EA 138 COLOR BayerBG2RGB EA COLOR BayerGB2RGB EA COLOR BayerRG2RGB EA COLOR BayerGR2RGB EA COLOR COLORCVT MAX Configuraci n Raspberry Pi COLOR BayerRG2BGR EA COLOR BayerGR2BGR EA COLOR BayerBG2BGR EA COLOR BayerGB2BGR EA 139 82 types of intersection between rectangles enum INTERSECT_NONE 8 INTERSECT_PARTIAL 1 INTERSECT FULL 2 2 finds arbitrary template in the grayscale image using Generalized Hough Transform class CV_EXPORTS GeneralizedHough public Algorithm public set template to search virtual void setTemplate InputArray templ Point templCenter Point 1 1 0 virtual void setTemplate InputArray edges InputArray dx InputArray dy Point templCenter Point 1 1 0 find template on image virtual void detect InputArray image OutputArray positions OutputArray votes noArray 0 virtual void detect InputArray edges InputArray dx InputArray dy OutputArray positions OutputArray votes noArray 8 Canny low threshold virtual void setCannyLowThresh int cannyLowThresh 8 virtual int getCannyLowThresh const 0 Canny high threshold virtual void setCannyHighThresh int cannyHighThresh 8 vir
10. Universidad de Oviedo Manual del programador del Trabajo Fin de M ster realizado por David Silva Montemayor para la obtenci n del t tulo de M ster en Ingenier a de Automatizaci n e Inform tica Industrial Estudio de viabilidad de un sistema basado en Raspberry Pi para aplicaciones de Inspecci n Industrial por Visi n Artificial Febrero 2015 ndice ndice de TS CLOG stereo 3 1 Recursos INECES ANOS CS 5 1 Recursos Nard Ware eerie dada 5 1 2 Recursos SoftWare ai Dia aie iara a 5 1 3 amp Rec ursosh rianos cuc up usus has A EEUU us EE SERE ERO 5 2 Operaciones para la modificaci n del software 6 3 Instalaci n del sistema nennen 7 4 Configuraci n b sica de la Raspberry Pi 9 5 Configuraci n para acceso remoto 15 5 1 Conexi n de la Raspberry Pi directamente al Pc usando cable de red 16 5 1 1 Configuraci n de Windows 7 u 8 direcci n est tica 17 5 1 2 Configuraci n direcci n est tica Raspberry Pi 18 5 1 3 Comprobar el xit
11. CV_EXPORTS_W void dct InputArray src OutputArray dst int flags performs inverse 1D or 2D Discrete Cosine Transformation CV_EXPORTS_W void idct InputArray src OutputArray dst int flags computes element wise product of the two Fourier spectrums The second spectrum can optionally be conjugated before the multiplication CV_EXPORTS_W void mulSpectrums InputArray a InputArray b OutputArray c int flags bool conjB false computes the minimal vector size vecsizel gt vecsize so that the dft of the vector of length vecsizel can be computed efficiently CV EXPORTS int getOptimalDFTSize int vecsize clusters the input data using k Means algorithm CV EXPORTS W double kmeans InputArray data int K InputOutputArray bestLabels TermCriteria criteria int attempts int flags OutputArray centers noArray returns the thread local Random number generator CV EXPORTS RNG amp theRNG fills array with uniformly distributed random numbers from the range low high Configuraci n Raspberry Pi 61 CV_EXPORTS_W void randu InputOutputArray dst InputArray low InputArray high fills array with normally distributed random numbers with the specified mean and the standard deviation CV_EXPORTS_W void randn InputOutputArray dst InputArray mean InputArray stddev shuffles the input array elements CV_EXPORTS_W void randShuffle InputOutputArray dst double iterFactor 1 RNG r
12. bool _readonly int offset Algorithm Getter _getter 0 Algorithm Setter _setter 0 Configuraci n Raspberry Pi 72 const String amp _help String int type int offset bool readonly Algorithm Getter getter Algorithm Setter setter String help template lt gt struct ParamType lt bool gt typedef bool const_param_type typedef bool member_type enum type Param BOOLEAN template lt gt struct ParamType lt int gt typedef int const_param_type typedef int member_type enum type Param INT J template lt gt struct ParamType lt double gt i typedef double const param type typedef double member type enum type Param REAL template lt gt struct ParamType lt String gt typedef const String amp const_param_type typedef String member_type enum type Param STRING template lt gt struct ParamType lt Mat gt typedef const Mat amp const_param_type typedef Mat member_type enum type Param MAT template lt gt struct ParamType lt std vector lt Mat gt gt typedef const std vector lt Mat gt amp const_param_type typedef std vector lt Mat gt member_type Configuraci n Raspberry Pi 73 enum type Param MAT VECTOR template lt gt struct ParamType lt Algorithm gt 1 typedef const Ptr Algorithm amp const param type typedef Ptr Algorithm member type enum type Param ALGORITHM templ
13. class CV_EXPORTS_W CLAHE public Algorithm public CV_WRAP virtual void apply InputArray src OutputArray dst 0 CV_WRAP virtual void setClipLimit double clipLimit 0 CV_WRAP virtual double getClipLimit const 8 CV_WRAP virtual void setTilesGridSize Size tileGridSize 0 CV_WRAP virtual Size getTilesGridSize const 8 CV_WRAP virtual void collectGarbage 0 class CV EXPORTS W Subdiv2D public enum PTLOC ERROR 2 PTLOC_OUTSIDE_RECT 1 PTLOC_INSIDE 0 PTLOC VERTEX 1 PTLOC ON EDGE 2 enum NEXT AROUND ORG 0x00 NEXT_AROUND_DST 0x22 PREV AROUND ORG 0x11 PREV_AROUND_DST 0x33 NEXT_AROUND_LEFT 0x13 NEXT_AROUND_RIGHT 0x31 PREV_AROUND_LEFT 0x20 PREV_AROUND_RIGHT 0x02 CV WRAP Subdiv2D CV WRAP Subdiv2D Rect rect CV WRAP void initDelaunay Rect rect CV WRAP int insert Point2f pt CV WRAP void insert const std vector lt Point2f gt amp ptvec CV WRAP int locate Point2f pt CV OUT int amp edge CV OUT int amp vertex Configuraci n Raspberry Pi 85 CV_WRAP int findNearest Point2f pt CV_OUT Point2f nearestPt 0 CV WRAP void getEdgeList CV OUT std vector lt Vec4f gt amp edgeList const CV_WRAP void getTriangleList CV OUT std vector lt Vec6f gt amp triangleList const CV_WRAP void getVoronoiFacetList const std vector lt int gt amp idx CV OUT std vector lt std vector lt Point2f gt gt amp facetList CV OUT std vector
14. int pos OpenGL support CV_EXPORTS void imshow const String amp winname const ogl Texture2D amp tex CV EXPORTS void setOpenGlDrawCallback const String amp winname OpenGlDrawCallback onOpenGlDraw void userdata 0 CV EXPORTS void setOpenGlContext const String amp winname CV EXPORTS void updateWindow const String amp winname Only for Qt struct QtFont 1 Configuraci n Raspberry Pi 50 const char nameFont Qt nameFont Scalar color Qt ColorFont gt cvScalar blue component green component red _component alpha_component int font_face Qt bool italic const int ascii font data and metrics const int gneek const int cyrillic float hscale vscale float shear slope coefficient 0 normal 0 italic int thickness Qt weight float dx horizontal interval between letters int line type Qt PointSize CV EXPORTS QtFont fontQt const String amp nameFont int pointSize 1 Scalar color Scalar a11 8 int weight QT_FONT_NORMAL int style QT_STYLE_NORMAL int spacing 0 CV_EXPORTS void addText const Mat amp img const String amp text Point org const QtFont amp font CV EXPORTS void displayOverlay const String amp winname const String amp text int delayms 8 CV_EXPORTS void displayStatusBar const String amp winname const String amp text int delayms 0 CV_EXPORTS void saveWindowParameters const String amp windowName
15. 0k gt lt Cancel gt Configuring keyboard configuration Please select the layout matching the keyboard for this machine Keyboard layout Spanist Spanish Asturian Spain with bottom dot H and bottom dot L Spanish Catalan Spain with middle dot L Spanish Spanish Dvorak Spanish Spanish eliminate dead keys Spanish Spanish include dead tilde Spanish Spanish Macintosh Spanish Spanish Sun dead keys Other lt Cancel gt Configuring keyboard configuration With some keyboard layouts AltGr is a modifier key used to input some characters primarily ones that are unusual for the Language of the keyboard layout such as foreign currency symbols and accented letters These are often printed as an extra symbol on keys Key to function as AltGr e default t No AltGr key Right Alt AltGr 4 Right Control Right Logo key Menu key Left Alt lt 0k gt lt Cancel gt Configuring keyboard configuration The Compose key known also as Multi_key causes the computer to interpret the next few keystrokes as a combination in order to produce a character not found on the keyboard On the text console the Compose key does not work in Unicode mode If not in Unicode mode regardless of what you choose here you can always also use the Control period combination as a Compose key Compose key Right Alt AltGr Right Control Right Lo
16. 1 geometry 1280x800 depth 16 pixelformat rgb565 Donde 1 indica el n mero de escritorio 1280x800 la resoluci n que a la que se muestra se puede ajustar si se necesita ayuda basta con ejecutar vncserver help La primera vez que se ejecuta se pide una contrase a que ser la que proteja el escritorio 5 3 2 VNC por medio de aplicaciones Existen diferentes herramientas para acceder remotamente a la Raspberry Pi desde el Pc Entre las mejores se encuentra VNC Viewer for Google Chrome es la que da una respuesta m s r pida y una mejor calidad de imagen Para instalarlo basta con buscarlo en la secci n de aplicaciones de Chrome Basta con introducir la IP de la Raspberry seguido del n mero de escritorio que se haya seleccionado en el paso anterior tambi n pedir la contrase a de este mismo paso Address 192 168 137 2 1 Picture Quality Automatic llustraci n 27 VNC Viewer Configuraci n Raspberry Pi 23 6 OpenCV en Raspberry Pi Para instalar las librer as de visi n de OpenCV en una Raspberry Pi se ha de tener paciencia pues es un proceso que puede llevar casi 12 horas El primer paso es descargarlo para ello elegimos el directorio en el que queremos instalarlo en este caso el directorio por defecto File Edit Tabs Help llustraci n 28 Directorio por defecto e Para descargar la ltima versi n de OpenCV se ejecuta el siguiente comando git clone https github com Itseez op
17. 1 int borderType BORDER_CONSTANT const Scalar amp borderValue morphologyDefaultBorderValue applies an advanced morphological operation to the image CV_EXPORTS_W void morphologyEx InputArray src OutputArray dst int op InputArray kernel Point anchor Point 1 1 int iterations 1 int borderType BORDER_CONSTANT const Scalar amp borderValue morphologyDefaultBorderValue resizes the image CV_EXPORTS_W void resize InputArray src OutputArray dst Size dsize double fx 8 double fy int interpolation INTER LINEAR warps the image using affine transformation CV_EXPORTS_W void warpAffine InputArray src OutputArray dst InputArray M Size dsize int flags INTER LINEAR int borderMode BORDER_CONSTANT const Scalar amp borderValue Scalar warps the image using perspective transformation CV_EXPORTS_W void warpPerspective InputArray src OutputArray dst Configuraci n Raspberry Pi 91 InputArray M Size dsize int flags INTER_LINEAR int borderMode BORDER_CONSTANT const Scalar amp bordervalue Scalar warps the image using the precomputed maps The maps are stored in either floating point or integer fixed point format CV_EXPORTS_W void remap InputArray src OutputArray dst InputArray map1 InputArray map2 int interpolation int borderMode BORDER CONSTANT const Scalar amp borderValue Scalar converts maps for remap from floating p
18. CV WRAP CV WRAP CV WRAP CV WRAP CV WRAP CV WRAP const int getInt const String amp name const double getDouble const String amp name const bool getBool const String amp name const String getString const String amp name const Mat getMat const String amp name const std vector Mat getMatVector const String amp name const Ptr Algorithm getAlgorithm const String amp name const void set const String amp name int value void set const String amp name double value Configuraci n Raspberry Pi 69 void void void void void value CV_WRAP CV_WRAP CV_WRAP CV_WRAP CV_WRAP CV_WRAP value CV_WRAP value set const set const set const set const set const void void void void void void void String amp String amp String amp String amp String amp template lt typename _Tp gt name name name name name void set const String amp name const Ptr lt _Tp gt amp bool value const String amp value const Mat amp value const std vector lt Mat gt amp value const Ptr lt Algorithm gt amp value setInt const String amp name int value setDouble const String amp name double value setBool const String amp name bool value setString const String amp name const String amp value setMat const String amp name const Mat amp value setMatVector const String amp name const std vector lt Mat gt amp setAlgorithm const
19. Canny InputArray image OutputArray edges double thresholdi double threshold2 int apertureSize 3 bool L2gradient false computes minimum eigen value of 2x2 derivative covariation matrix at each pixel the cornerness criteria CV EXPORTS W void cornerMinEigenVal InputArray src OutputArray dst int blockSize int ksize 3 int borderType BORDER DEFAULT computes Harris cornerness criteria at each image pixel CV EXPORTS W void cornerHarris InputArray src OutputArray dst int blockSize int ksize double k int borderType BORDER DEFAULT computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel The output is stored as 6 channel matrix CV EXPORTS W void cornerEigenValsAndVecs InputArray src OutputArray dst int blockSize int ksize int borderType BORDER DEFAULT computes another complex cornerness criteria at each pixel CV EXPORTS W void preCornerDetect InputArray src OutputArray dst int ksize int borderType BORDER DEFAULT adjusts the corner locations with sub pixel accuracy to maximize the certain cornerness criteria CV EXPORTS W void cornerSubPix InputArray image InputOutputArray corners Size winSize Size zeroZone TermCriteria criteria finds the strong enough corners where the cornerMinEigenVal or cornerHarris report the local maxima CV EXPORTS W void goodFeaturesToTrack InputArray image OutputArray corners int
20. Conexi n de la Raspberry Pi directamente al Pc usando cable de red Para saber la IP de la Raspberry Pi desde terminal ejecutamos ifconfig a Es la que se encuentra en la secci n ethO en la segunda l nea E pi raspberrypi ls Ilustraci n 16 IP Raspberry Pi Para comprobar si tiene acceso a internet basta con hacer ping a cualquier p gina de internet Una vez comprobado esto conectaremos la Raspberry Pi al ordenador para poder configurar el equipo y tener acceso remoto seguiremos necesitando la pantalla el teclado y el rat n Ilustraci n 17 Conexi n entre ordenador y Raspberry Pi Configuraci n Raspberry Pi 16 5 1 1 Configuraci n de Windows 7 u 8 direcci n est tica Paso 1 es necesario compartir la conexi n Wi Fi o la conexi n Ethernet que se tenga para acceder a la red para ello es necesario activar el uso compartido de internet entre las dos interfaces Click derecho en el icono de red gt Abrir centro de redes y recursos compartidos Paso 2 identificar la conexi n principal y clicar sobre ella y despu s en Propiedades esto nos abre Propiedades de Conexi n de red inal mbrica Ver mapa complet d Funciones de red Uso compartido Conexi n compartida a Intemet General T Internet Conexi n Conectividad IPv4 Internet Conectividad IPv6 Sin acceso a la red Estado del medio Habilitado V Permitir que los usuarios de otras redes se conect
21. En ella se descomprime el archivo reci n descargado y una vez finalizado este proceso la insertaremos en la Raspberry Pi Para continuar con la instalaci n sera necesario un cable HDMI y una pantalla con esta entrada o en su defecto un cable RCA de video un teclado un rat n estos pueden ser inalambricos funciona sin problemas y un cable de red para establecer la conexi n a internet Una vez que est todo conectado conectamos el cable de alimentaci n el ctrica Elecci n del sistema operativo Raspbian ademas es el recomendado Tambi n seleccionamos idioma del instalador ingl s no hay espa ol y el idioma del teclado es de espa ol Configuraci n Raspberry Pi 7 NOOBS v1 3 0 Built Sep 4 2013 2 a Install i Edit config e Online help h Exit Esc Raspbian RECOMMENDED A Debian wheezy port optimised for the Raspberry Pi OpenELEC OpenELEC is a fast and userfriendly XBMC Mediacenter distribution RISC OS RISC OS is a very fast and compact system Raspbian Boot to Desktop A version of Raspbian that boots straight to a GUI Arch An Arch Linux port for ARM devices RaspBMC An XBMC media center distribution for Raspberry Pi Available 6881 MB Language I English UK Keyboard 9 Ilustraci n 2 Primer paso Una vez seleccionado todo correctamente clicamos en el bot n de arriba a la izquierda Install nos informa de que borrar la tarjeta SD acept
22. SUMMER 6 COLORMAP SPRING 7 COLORMAP COOL 8 COLORMAP HSV 9 COLORMAP PINR 10 COLORMAP HOT 11 CV_EXPORTS_W void applyColorMap InputArray src OutputArray dst int colormap draws the line segment pt1 pt2 in the image CV_EXPORTS_W void line InputOutputArray img Point pt1 Point pt2 const Scalar amp color int thickness 1 int lineType LINE_8 int shift 8 draws an arrow from pt1 to pt2 in the image CV EXPORTS W void arrowedLine InputOutputArray img Point pt1 Point pt2 const Scalar amp color int thickness 1 int line type 8 int shift 0 double tipLength 0 1 Configuraci n Raspberry Pi 99 draws the rectangle outline or a solid rectangle with the opposite corners pt1 and pt2 in the image CV_EXPORTS_W void rectangle InputOutputArray img Point pt1 Point pt2 const Scalar amp color int thickness 1 int lineType LINE_8 int shift 0 draws the rectangle outline or a solid rectangle covering rec in the image CV_EXPORTS void rectangle CV_IN_OUT Mat amp img Rect rec const Scalar amp color int thickness 1 int lineType LINE_8 int shift 0 draws the circle outline or a solid circle in the image CV_EXPORTS_W void circle InputOutputArray img Point center int radius const Scalar amp color int thickness 1 int lineType LINE_8 int shift 0 draws an elliptic arc ellipse sector or a rotated ellipse in the image CV_EXPORTS_W void elli
23. W int connectedComponents InputArray image OutputArray labels int connectivity 8 int ltype CV 32S CV EXPORTS W int connectedComponentsWithStats InputArray image OutputArray labels OutputArray stats OutputArray centroids int connectivity 8 int ltype CV 32S retrieves contours and the hierarchical information from black n white image CV EXPORTS W void findContours InputOutputArray image OutputArrayOfArrays contours OutputArray hierarchy int mode int method Point offset Point retrieves contours from black n white image CV EXPORTS void findContours InputOutputArray image OutputArrayOfArrays contours int mode int method Point offset Point approximates contour or a curve using Douglas Peucker algorithm CV EXPORTS W void approxPolyDP InputArray curve OutputArray approxCurve double epsilon bool closed computes the contour perimeter closed true or a curve length CV EXPORTS W double arcLength InputArray curve bool closed computes the bounding rectangle for a contour CV EXPORTS W Rect boundingRect InputArray points Configuraci n Raspberry Pi 97 computes the contour area CV_EXPORTS_W double contourArea InputArray contour bool oriented false computes the minimal rotated rectangle for a set of points CV_EXPORTS_W RotatedRect minAreaRect InputArray points computes boxpoints CV_EXPORTS_W void boxPoints RotatedRect box Output
24. buffer to encoder output port d n q if mmal_port_parameter_set_boolean camera_video_port MMAL PARAMETER CAPTURE 1 MMAL SUCCESS printf s Failed to start capture n _ func cout lt lt Capture started lt lt endl Configuraci n Raspberry Pi 41 Settings int PiCapture setSaturation int saturation int ret 0 if camera return 1 if saturation gt 100 88 saturation lt 188 MMAL RATIONAL value saturation 100 ret mmal status to int mmal port parameter set rational camera control MMAL PARAMETER SATURATION value else printf Invalid saturation value ret 1 return ret int PiCapture setSharpness int sharpness int ret 0 if camera return 1 if sharpness gt 100 amp amp sharpness lt 100 MMAL_RATIONAL_T value sharpness 100 ret mmal status to int mmal port parameter set rational camera control MMAL PARAMETER SHARPNESS value j else printf Invalid value ret 1 return ret int PiCapture setContrast int contrast int ret 0 if camera return 1 if contrast gt 100 88 contrast lt 100 MMAL_RATIONAL_T value contrast 100 ret mmal status to int mmal port parameter set rational camera control MMAL PARAMETER CONTRAST value Configuraci n Raspberry Pi 42 else printf Invalid contrast value re
25. computed basis ready to use if testset data Configuraci n Raspberry Pi 62 return pca CV_Assert testset cols pcaset cols compressed create testset rows maxComponents testset type Mat reconstructed for int i 0 i lt testset rows i Mat vec testset row i coeffs compressed row i reconstructed compress the vector the result will be stored in the i th row of the output matrix pca project vec coeffs and then reconstruct it pca backProject coeffs reconstructed and measure the error printf Xd diff g n i norm vec reconstructed NORM L2 return pca endcode class CV_EXPORTS PCA t public enum DATA AS ROW 8 DATA AS COL 1 USE AVG 2 default constructor PCA the constructor that performs PCA PCA InputArray data InputArray mean int flags int maxComponents 0 PCA InputArray data InputArray mean int flags double retainedVariance operator that performs PCA The previously stored data if any is released PCA amp operator InputArray data InputArray mean int flags int maxComponents 0 PCA amp operator InputArray data InputArray mean int flags double retainedVariance projects vector from the original space to the principal components subspace Mat project InputArray vec const projects vector from the original space to the principal components subspace void project InputArray vec
26. distCoeffs InputArray R InputArray newCameraMatrix Size size int mltype OutputArray map1 OutputArray map2 initializes maps for cv remap for wide angle CV_EXPORTS_W float initWideAngleProjMap InputArray cameraMatrix InputArray distCoeffs Size imageSize int destImageWidth int mltype OutputArray map1 OutputArray map2 int projType PROJ_SPHERICAL_EQRECT double alpha 8 returns the default new camera matrix by default it is the same as cameraMatrix unless centerPricipalPoint true CV_EXPORTS_W Mat getDefaultNewCameraMatrix InputArray cameraMatrix Size imgsize Size bool centerPrincipalPoint false returns points coordinates after lens distortion correction CV_EXPORTS_W void undistortPoints InputArray src OutputArray dst InputArray cameraMatrix InputArray distCoeffs InputArray R noArray InputArray P noArray computes the joint dense histogram for a set of images CV EXPORTS void calcHist const Mat images int nimages const int channels InputArray mask Configuraci n Raspberry Pi 94 OutputArray hist int dims const int histSize const float ranges bool uniform true bool accumulate false computes the joint sparse histogram for a set of images CV_EXPORTS void calcHist const Mat images int nimages const int channels InputArray mask SparseMat amp hist int dims const int histSize const float ranges bool uniform true bool acc
27. distributed double precision floating point random number from a b range double uniform double a double b private enum PeriodParameters N 624 M 397 unsigned state N int mti Formatted output of cv class CV EXPORTS Formatted public virtual const char next 0 virtual void reset 0 virtual Formatted class CV_EXPORTS Formatter public enum FMT_DEFAULT FMT_MATLAB 8 1 Configuraci n Raspberry Pi Mat 68 J virtual virtual virtual virtual virtual static FMT_CSV 2 FMT_PYTHON 3 FMT_NUMPY 4 FMT_C 5 Formatter Ptr Formatted format const Mat amp mtx const 0 void set32fPrecision int p 8 0 void set64fPrecision int p 16 0 void setMultiline bool ml true 6 Ptr Formatter get int fmt FMT DEFAULT Algorithm TITEL THREE class CV EXPORTS Algorithm class CV EXPORTS AlgorithmInfo struct CV EXPORTS AlgorithmInfoData template ty UE Base clas el pename _Tp gt struct ParamType s for high level OpenCV algorithms class CV EXPORTS W Algorithm public Algorit virtual String hm Algorithm name const template typename Tp typename ParamType Tp member type get const String amp name const template typename Tp typename ParamType Tp member type get const char name CV WRAP
28. el ejemplo y para distinguir como funcionar con cada una Para trabajar con una IIplmage se trabajara siempre con los datos mientras que para trabajar con una Mat convertida a Iplimage se ha de trabajar usando el operador de direcci n amp En la ilustraci n 38 se muestra un ejemplo en el que se captura una imagen se binariza y se muestra la original y la binarizada En el caso de usar C que es el lenguaje que se ha usado en este proyecto se facilita bastante la tarea pues se puede trabajar con objetos Mat en todas las funciones basta con adecuar las librer as y las funciones de OpenCV a este lenguaje pues la mayor a de las funciones de OpenCV en C soporta objetos tipo Mat como par metros de entrada Configuraci n Raspberry Pi 32 8 C digo En este apartado se mostrar n los archivos empleados para la facilitar el entendimiento del presente proyecto 8 1 C digo fuente 8 1 1 Rutina principal En este archivo es donde se lleva a cabo el tratamiento de las im genes procedentes de la c mara para realizar la b squeda de la soldadura Se ejecutar continuamente hasta que se pulse la tecla q del teclado C digo main cpp Archivos de cabecera necesarios include cap h include lt home pi opencv include opencv2 opencv hpp gt include lt home pi opencv modules highgui include opencv2 highgui highgui hpp gt include lt home pi opencv modules core include opencv2 core core hpp gt include lt home pi
29. n Raspberry Pi void write FileStorage amp fs const void read const FileNode amp fn Algorithm Constructor void int Algorithm Getter const void Algorithm Setter int static void getList CV_OUT std vector lt String gt amp algorithms static Ptr lt Algorithm gt _create const String amp name 70 template lt typename _Tp gt static Ptr lt _Tp gt create const String amp name virtual AlgorithmInfo info const TODO make it 0 return 8 J class CV_EXPORTS AlgorithmInfo public friend class Algorithm AlgorithmInfo const String amp name Algorithm Constructor create AlgorithmInfo void get const Algorithm algo const char name int argType void value const void addParam_ Algorithm amp algo const char name int argType void value bool readOnly Algorithm Getter getter Algorithm Setter setter const String amp help String String paramHelp const char name const int paramType const char name const void getParams std vector lt String gt amp names const void write const Algorithm algo FileStorage amp fs const void read Algorithm algo const FileNode amp fn const String name const void addParam Algorithm amp algo const char name int amp value bool readOnly false int Algorithm getter 0 void Algorithm setter int 0 const String amp help String void addParam Algorithm amp algo const char name bool amp va
30. of a square matrix CV EXPORTS double determinant InputArray mtx computes trace of a matrix CV EXPORTS W Scalar trace InputArray mtx computes inverse or pseudo inverse matrix CV EXPORTS W double invert InputArray src OutputArray dst int flags DECOMP LU solves linear system or a least square problem CV_EXPORTS_W bool solve InputArray srcl InputArray src2 OutputArray dst int flags DECOMP LU sorts independently each matrix row or each matrix column CV_EXPORTS_W void sort InputArray src OutputArray dst int flags sorts independently each matrix row or each matrix column CV_EXPORTS_W void sortIdx InputArray src OutputArray dst int flags finds real roots of a cubic polynomial CV_EXPORTS_W int solveCubic InputArray coeffs OutputArray roots finds real and complex roots of a polynomial CV_EXPORTS_W double solvePoly InputArray coeffs OutputArray roots int maxIters 300 finds eigenvalues and eigenvectors of a symmetric matrix CV_EXPORTS_W bool eigen InputArray src OutputArray eigenvalues OutputArray eigenvectors noArray computes covariation matrix of a set of samples CV_EXPORTS void calcCovarMatrix const Mat samples int nsamples Mat amp covar Mat amp mean int flags int ctype CV_64F TODO InputArrayOfArrays computes covariation matrix of a set of samples CV_EXPORTS_W void calcCovarMatrix InputArray samples OutputArray covar InputOutputAr
31. rate num height 30 Configuraci n Raspberry Pi 40 format gt es gt video frame_rate den 1 camera_video_port gt buffer_size width height 3 2 camera_video_port gt buffer_num 1 status mmal_port_format_commit camera_video_port if status MMAL_SUCCESS printf Error unable to commit camera video port format u n status create pool form camera video port camera video port pool MMAL POOL T mmal port pool create camera video port camera video port buffer num camera video port buffer size if color status mmal port enable camera video port color callback if status MMAL SUCCESS printf Error unable to enable camera video port u n status else cout Attached color callback endl else status mmal port enable camera video port gray_callback if status MMAL SUCCESS printf Error unable to enable camera video port u n status else cout lt lt Attached gray callback lt lt endl status mmal_component_enable camera Send all the buffers to the camera video port int num mmal queue length camera video port pool queue int q for q 0 q lt num q MMAL_BUFFER_HEADER_T buffer mmal queue get camera video port pool queue if buffer printf Unable to get a required buffer Xd from pool queueNn q if mmal port send buffer camera video port buffer MMAL_SUCCESS printf Unable to send a
32. the specified range CV_EXPORTS_W bool checkRange InputArray a bool quiet true CV_OUT Point pos 80 double minVal DBL_MAX double maxVal DBL MAX converts NaN s to the given number CV EXPORTS void patchNaNs InputOutputArray a double val 8 implements generalized matrix product algorithm GEMM from BLAS CV EXPORTS W void gemm InputArray srcl InputArray src2 double alpha InputArray src3 double beta OutputArray dst int flags 0 multiplies matrix by its transposition from the left or from the right CV EXPORTS W void mulTransposed InputArray src OutputArray dst bool aTa InputArray delta noArray double scale 1 int dtype 1 transposes the matrix CV EXPORTS W void transpose InputArray src OutputArray dst performs affine transformation of each element of multi channel input matrix CV EXPORTS W void transform InputArray src OutputArray dst InputArray m performs perspective transformation of each element of multi channel input matrix CV EXPORTS W void perspectiveTransform InputArray src OutputArray dst InputArray m extends the symmetrical matrix from the lower half or from the upper half CV EXPORTS void completeSymm InputOutputArray mtx bool lowerToUpper false Configuraci n Raspberry Pi 59 initializes scaled identity matrix CV_EXPORTS_W void setIdentity InputOutputArray mtx const Scalar amp s Scalar 1 computes determinant
33. 0 return int setAWBGains float gain float b gain brief setImageFX param imageFX 0 23 return int setImageFX MMAL PARAM IMAGEFX T imageFX TODO example int setColourFX MMAL PARAM COLOURFX T colourFX TODO example per brief setRotation param rotation 0 359 try 0 90 180 270 return int setRotation int rotation brief setFlips param hflip 0 1 treat as bool param vflip 0 1 treat as bool return int setFlips int hflip int vflip ER brief setROI param rect has x y w h and expects normalized values return int setROI PARAM FLOAT RECT T rect brief setShutterSpeed param speed 0 330000 in microseconds 8 is auto return int setShutterSpeed int speed int mmal status to int MMAL STATUS T status if status MMAL_SUCCESS return 0 else Configuraci n Raspberry Pi 37 switch status 1 case case memory break case case case break case break case case case not POSIX break case MMAL ENOTREADY FIXME not POSIX case MMAL ENOMEM MMAL ENOSPC MMAL EINVAL MMAL ENOSYS MMAL ENOENT MMAL ENXIO MMAL EIO MMAL ESPIPE MMAL ECORRUPT break MMAL ECONFIG printf Out of memory break printf Out of resources other than printf Argument is invalid break printf Function not implemented break printf No such file or directory printf No such dev
34. 8 137 1 Configuraci n Raspberry Pi 17 Ver mapa completo Estado del medio Habilitado Duraci n 00 51 30 Velocidad 100 0 Mbps Conectar o desconectar Detalles Internet ail Conexi n de red inal mbrica Actividad Guest w Mu Habita Sin acceso a Internet Conexi n de rea local VirtualBox Host Only Network General Puede hacer que la configuraci n IP se asigne autom ticamente si la red es compatible con esta funcionalidad De lo contrario deber consultar con el administrador de red cu l es la configuraci n IP apropiada Obtener una direcci n IP autom ticamente Usar la siguiente direcci n IP Realtek PCle GBE Family Controller conexi n usa los siguientes elementos OM Cliente para redes Microsoft d VirtualBox Bridged Networking Driver 8 Programador de paquetes QoS LE Compartir impresoras y archivos para redes Microsoft Direcci n IP 192 168 137 1 M scara de subred 255 255 255 0 Puerta de enlace predeterminada Obtener la direcci n del servidor DNS autom ticamente 9 Usar las siguientes direcciones de servidor DNS Servidor DNS preferido E j Servidor DNS alternativo Validar configuraci n al salir Ilustraci n 19 Direcci n est tica Pc 5 1 2 Configuraci n direcci n est tica Raspberry Pi Paso 1 en la v
35. Array CV OUT double response 0 CV_EXPORTS_W void createHanningWindow OutputArray dst Size winSize int type applies fixed threshold to the image CV_EXPORTS_W double threshold InputArray src OutputArray dst double thresh double maxval int type applies variable adaptive threshold to the image CV_EXPORTS_W void adaptiveThreshold InputArray src OutputArray dst double maxValue int adaptiveMethod int thresholdType int blockSize double smooths downsamples the image CV_EXPORTS_W void pyrDown InputArray src OutputArray dst Configuraci n Raspberry Pi 93 const Size amp dstsize Size int borderType BORDER_DEFAULT upsamples and smoothes the image CV_EXPORTS_W void pyrUp InputArray src OutputArray dst const Size amp dstsize Size int borderType BORDER_DEFAULT builds the gaussian pyramid using pyrDoun as a basic operation CV_EXPORTS void buildPyramid InputArray src OutputArrayOfArrays dst int maxlevel int borderType BORDER_DEFAULT corrects lens distortion for the given camera matrix and distortion coefficients CV_EXPORTS_W void undistort InputArray src OutputArray dst InputArray cameraMatrix InputArray distCoeffs InputArray newCameraMatrix noArray initializes maps for cv remap to correct lens distortion and optionally rectify the image CV_EXPORTS_W void initUndistortRectifyMap InputArray cameraMatrix InputArray
36. Array points computes the minimal enclosing circle for a set of points CV_EXPORTS_W void minEnclosingCircle InputArray points CV_OUT Point2f amp center CV_OUT float amp radius computes the minimal enclosing triangle for a set of points and returns its area CV_EXPORTS_W double minEnclosingTriangle InputArray points CV_OUT OutputArray triangle matches two contours using one of the available algorithms CV_EXPORTS_W double matchShapes InputArray contour1 InputArray contour2 int method double parameter computes convex hull for a set of 2D points CV_EXPORTS_W void convexHull InputArray points OutputArray hull bool clockwise false bool returnPoints true computes the contour convexity defects CV_EXPORTS_W void convexityDefects InputArray contour InputArray convexhull OutputArray convexityDefects returns true if the contour is convex Does not support contours with self intersection CV_EXPORTS_W bool isContourConvex InputArray contour finds intersection of two convex polygons CV_EXPORTS_W float intersectConvexConvex InputArray _p1 InputArray _p2 OutputArray _p12 bool handleNested true fits ellipse to the set of 2D points CV_EXPORTS W RotatedRect fitEllipse InputArray points fits line to the set of 2D points using M estimator algorithm CV_EXPORTS_W void fitLine InputArray points OutputArray line int distType double param double reps dou
37. Codigo compilare 47 8 3 OpenCW ak u nant ant etat mentalitat manen 48 E A AS esser RENE ES 48 83 2 Core hipp ES O el ler 52 8 3 3 Imgprochpp z uie BEER TOR HR ida 75 ECT PEE GATES 102 Configuraci n Raspberry Pi 2 ndice de ilustraciones ll straci n 1 NOOBS u u oi s orte 7 llustraci n 2 Primer paso aas assa nans 8 Ilustraci n 3 Instalaci n terminada 8 llustraci n 4 Configuraci n Raspberry Pi 9 llustraci n 5 Partici n uu uuu asa 9 llustraci n 6 Opci n escritorio 10 Ilustraci n 7 Opci n internacionalizaci n 10 Ilustraci n 8 Internacionalizaci n 2 nennen ener nnne nnns 11 Ilustraci n 9 Internacionalizaci n 3 esses eene eene nnne nnne enne nnns 11 llustr ci n 10 Zona horaria iicet rede ce I Cl rion n d 11 Ilustraci n 11 Configuraci n teclado
38. InputArray src OutputArray dst InputArray mask noArray computes element wise absolute difference of two arrays dst abs src1 src2 CV_EXPORTS_W void absdiff InputArray srcl InputArray src2 OutputArray dst set mask elements for those array elements which are within the element specific bounding box dst lowerb lt src amp amp src lt upperb CV_EXPORTS_W void inRange InputArray src InputArray lowerb InputArray upperb OutputArray dst compares elements of two arrays dst srcl lt cmpop gt src2 CV_EXPORTS_W void compare InputArray srcl InputArray src2 OutputArray dst int cmpop computes per element minimum of two arrays dst min srci src2 CV EXPORTS void min InputArray srcl InputArray src2 OutputArray dst computes per element maximum of two arrays dst max src1 src2 CV EXPORTS W void max InputArray srcl InputArray src2 OutputArray dst the following overloads are needed to avoid conflicts with if const _Tp amp std min const _Tp amp const _Tp amp _Compare computes per element minimum of two arrays dst min src1 src2 CV EXPORTS void min const Mat srcl const Mat src2 Mat amp dst computes per element maximum of two arrays dst max srci src2 CV EXPORTS void max const Mat amp srcl const Mat amp src2 Mat amp dst computes per element minimum of two arrays dst min srci src2 CV_EXPORTS void min const UMat amp srcl con
39. NV21 COLOR YUV2GRAY NV12 COLOR YUV2GRAY 420 COLOR YUV2GRAY 420 COLOR YUV2GRAY 420 COLOR YUV2GRAY 420 COLOR YUV2GRAY 420 80 COLOR YUV420sp2GRAY COLOR YUV420p2GRAY COLOR YUV2GRAY 420 COLOR YUV2GRAY 420 YUV 4 2 2 family to RGB COLOR YUV2RGB UYVY COLOR YUV2BGR UYVY COLOR YUV2RGB VYUY COLOR YUV2BGR VYUY COLOR YUV2RGB Y422 COLOR YUV2BGR Y422 COLOR YUV2RGB UYNV COLOR YUV2BGR UYNV COLOR YUV2RGBA UYVY COLOR YUV2BGRA UYVY COLOR YUV2RGBA VYUY COLOR YUV2BGRA VYUY COLOR YUV2RGBA Y422 COLOR YUV2BGRA Y422 COLOR YUV2RGBA UYNV COLOR YUV2BGRA UYNV COLOR YUV2RGB YUY2 COLOR YUV2BGR YUY2 COLOR YUV2RGB YVYU COLOR YUV2BGR YVYU COLOR YUV2RGB YUYV COLOR YUV2BGR YUYV COLOR YUV2RGB YUNV COLOR YUV2BGR YUNV COLOR YUV2RGBA YUY2 COLOR YUV2BGRA YUY2 COLOR YUV2RGBA YVYU COLOR YUV2BGRA YVYU COLOR YUV2RGBA YUYV COLOR YUV2BGRA YUYV COLOR YUV2RGBA YUNV COLOR YUV2BGRA YUNV COLOR YUV2GRAY UYVY COLOR YUV2GRAY YUY2 CV YUV2GRAY VYUY COLOR YUV2GRAY Y422 COLOR YUV2GRAY UYNV COLOR YUV2GRAY YVYU COLOR YUV2GRAY YUYV COLOR YUV2GRAY YUNV alpha premultipli COLOR RGBA2mRGBA COLOR mRGBA2RGBA RGB to YUV 4 2 0 Configuraci n Raspberry Pi 107 108 109 110 COLOR YUV2RGB UYVY COLOR YUV2BGR UYVY COLOR YUV2RGB UYVY COLOR YUV2BGR UYVY 111 112 113 114 COLOR YUV2RGBA UYVY COLOR YUV2BGRA UYVY COLOR YUV2RGBA UYVY COLOR YUV2BGRA UYVY 115 116
40. OutputArray result const reconstructs the original vector from the projection Configuraci n Raspberry Pi 63 Mat backProject InputArray vec const reconstructs the original vector from the projection void backProject InputArray vec OutputArray result const write and load PCA matrix void write FileStorage amp fs const void read const FileNode amp fs Mat eigenvectors lt eigenvectors of the covariation matrix Mat eigenvalues lt eigenvalues of the covariation matrix Mat mean lt mean value subtracted before the projection and added after the back projection Linear Discriminant Analysis class CV EXPORTS LDA public Initializes a LDA with num_components default and specifies how samples are aligned default dataAsRow true explicit LDA int num_components 0 Initializes and performs a Discriminant Analysis with Fisher s Optimization Criterion on given data in src and corresponding labels in labels If 8 or less number of components are given they are automatically determined for given data in computation LDA InputArrayOfArrays src InputArray labels int num_components 0 Serializes this object to a given filename void save const String amp filename const Deserializes this object from a given filename void load const String amp filename Serializes this object to a given cv FileStorage void save FileStorage amp fs const
41. R_GRAY2BGR COLOR_GRAY2RGB COLOR_GRAY2BGRA COLOR_GRAY2RGBA COLOR_BGRA2GRAY COLOR_RGBA2GRAY COLOR_BGR2BGR565 COLOR_RGB2BGR565 COLOR_BGR5652BGR COLOR_BGR5652RGB COLOR_BGRA2BGR565 COLOR_RGBA2BGR565 COLOR_BGR5652BGRA COLOR_BGR5652RGBA COLOR_GRAY2BGR565 COLOR_BGR5652GRAY Configuraci n Raspberry Pi 9 COLOR_BGR2BGRA 1 COLOR_BGRA2BGR 2 COLOR_BGR2RGBA 3 COLOR_RGBA2BGR 4 COLOR BGR2RGB 5 COLOR_BGRA2RGBA 6 7 8 COLOR GRAY2BGR 9 COLOR GRAY2BGRA 10 11 12 13 14 15 16 17 18 19 20 21 78 COLOR_BGR2BGR555 COLOR_RGB2BGR555 COLOR_BGR5552BGR COLOR_BGR5552RGB COLOR_BGRA2BGR555 COLOR_RGBA2BGR555 COLOR_BGR5552BGRA COLOR_BGR5552RGBA COLOR_GRAY2BGR555 COLOR_BGR5552GRAY COLOR_BGR2XYZ COLOR_RGB2XYZ COLOR_XYZ2BGR COLOR_XYZ2RGB COLOR BGR2YCrCb COLOR RGB2YCrCb COLOR YCrCb2BGR COLOR YCrCb2RGB COLOR BGR2HSV COLOR RGB2HSV COLOR BGR2Lab COLOR RGB2Lab COLOR BGR2Luv COLOR RGB2Luv COLOR BGR2HLS COLOR RGB2HLS COLOR HSV2BGR COLOR HSV2RGB COLOR Lab2BGR COLOR Lab2RGB COLOR Luv2BGR COLOR Luv2RGB COLOR HLS2BGR COLOR HLS2RGB COLOR BGR2HSV FULL COLOR RGB2HSV FULL COLOR BGR2HLS FULL COLOR RGB2HLS FULL COLOR HSV2BGR FULL COLOR HSV2RGB FULL COLOR HLS2BGR FULL COLOR HLS2RGB FULL Configuraci n Raspberry Pi 22 23 24 25 26 27 29 30 31 32 34 35 36 38 39 40 41 44 45 50 51 52 53
42. Scalar amp color int thickness 1 int lineType LINE_8 int shift 0 draws contours in the image CV_EXPORTS_W void drawContours InputOutputArray image InputArrayOfArrays contours int contourIdx const Scalar amp color int thickness 1 int lineType LINE 8 InputArray hierarchy noArray int maxLevel INT MAX Point offset Point clips the line segment by the rectangle Rect 0 0 imgSize width imgSize height CV_EXPORTS bool clipLine Size imgSize CV IN OUT Point amp pt1 CV_IN_OUT Point amp pt2 clips the line segment by the rectangle imgRect CV_EXPORTS_W bool clipLine Rect imgRect CV OUT CV IN OUT Point amp pt1 CV OUT CV IN OUT Point amp pt2 converts elliptic arc to a polygonal curve CV EXPORTS void ellipse2Poly Point center Size axes int angle int arcStart int arcEnd int delta CV OUT std vector lt Point gt amp pts renders text string in the image CV_EXPORTS_W void putText InputOutputArray img const String amp text Point org int fontFace double fontScale Scalar color int thickness 1 int lineType LINE_8 bool bottomLeftOrigin false returns bounding box of the text string CV_EXPORTS_W Size getTextSize const String amp text int fontFace double fontScale int thickness CV OUT int baseline cv endif Configuraci n Raspberry Pi 101 8 3 4 Cv hpp Es la cabecera que incluye todas o al menos las m s usadas libre
43. String void addParam Algorithm amp algo const char name unsigned int amp value bool readOnly false unsigned int Algorithm getter 0 void Algorithm setter unsigned int 0 const String amp help String void addParam Algorithm amp algo const char name uint64 amp value bool readOnly false uint64 Algorithm getter 0 void Algorithm setter uint64 0 const String amp help String void addParam Algorithm amp algo const char name uchar amp value bool readOnly false uchar Algorithm getter 0 void Algorithm setter uchar 0 const String amp help String template typename Tp typename _Base gt void addParam Algorithm amp algo const char name Ptr lt _Tp gt amp value bool readOnly false Ptr Tp Algorithm getter 0 void Algorithm setter const Ptr lt _Tp gt 8 0 const String amp help String template typename Tp void addParam Algorithm amp algo const char name Ptr Tp amp value bool readOnly false Ptr Tp Algorithm getter 0 void Algorithm setter const Ptr Tp amp 0 const String amp help String protected AlgorithmInfoData data void set Algorithm algo const char name int argType const void value bool force false const struct CV_EXPORTS Param enum INT 8 BOOLEAN 1 REAL 2 STRING 3 MAT 4 MAT_VECTOR 5 ALGORITHM 6 FLOAT 7 UNSIGNED INT 8 UINT64 9 UCHAR 11 Param Param int type
44. String amp name const Ptr lt Algorithm gt amp template lt typename _Tp gt void setAlgorithm const String amp name const Ptr lt _Tp gt amp value void void void void void void void set const set const set const set const set const set const set const char char char char char char char name name name name name name name int value double value bool value const String amp value const Mat amp value const std vector lt Mat gt amp value const Ptr lt Algorithm gt amp value template lt typename _Tp gt void set const char name const Ptr lt _Tp gt 8 value void void void void void void void setInt const char name int value setDouble const char name double value setBool const char name bool value setString const char name const String amp value setMat const char name const Mat amp value setMatVector const char name const std vector lt Mat gt amp value setAlgorithm const char name const Ptr lt Algorithm gt amp value template lt typename _Tp gt void setAlgorithm const char name const Ptr lt _Tp gt amp value CV_WRAP String paramHelp const String amp name const int paramType const char name const CV_WRAP int paramType const String amp name const CV_WRAP void getParams CV_OUT std vector lt String gt amp names const virtual virtual typedef typedef typedef CV_WRAP CV_WRAP Configuraci
45. THRESH_BINARY_INV THRESH_TRUNC value THRESH_TOZERO THRESH_TOZERO_INV THRESH_MASK THRESH_OTSU threshold value value value gt threshold P max value 0 value value gt threshold 0 max_value value value gt threshold threshold value value gt threshold 2 value value value gt threshold value use Otsu algorithm to choose the optimal adaptive threshold algorithm enum ADAPTIVE THRESH MEAN C ADAPTIVE THRESH GAUSSIAN C enum PROJ SPHERICAL ORTHO PROJ SPHERICAL EQRECT H Il e 9 1 class of the pixel in GrabCut algorithm background foreground most probably background most probably foreground y enum GC BGD 0 GC FGD 1 GC PR BGD 2 GC PR FGD 3 y 1 lt lt lt GrabCut algorithm flags enum GC_INIT_WITH_RECT GC_INIT_WITH_MASK GC_EVAL distanceTransform algorithm flags Configuraci n Raspberry Pi 76 enum DIST_LABEL_CCOMP DIST_LABEL_PIXEL E floodfill algorithm flags enum FLOODFILL FIXED RANGE 1 lt lt 16 FLOODFILL MASK ONLY 1 lt lt 17 H Il e type of the template matching operation enum TM_SQDIFF 0 TM SQDIFF NORMED TM CCORR TM CCORR NORMED TM CCOEFF TM NORMED h 3 3 1 2 3 4 5 3 connected components algorithm output formats enum CC_STAT_LEFT CC_STAT_TOP CC_STAT_WIDTH CC_STAT
46. TS_W Mat getGaborKernel Size ksize double sigma double theta double lambd double gamma double psi CV_PI 0 5 int ktype CV_64F returns magic border value for erosion and dilation It is automatically transformed to Scalar all DBL_MAX for dilation static inline Scalar morphologyDefaultBorderValue return Scalar all DBL_MAX returns structuring element of the specified shape and size CV_EXPORTS_W Mat getStructuringElement int shape Size ksize Point anchor Point 1 1 smooths the image using median filter Configuraci n Raspberry Pi 88 CV_EXPORTS_W void medianBlur InputArray src OutputArray dst int ksize smooths the image using Gaussian filter CV_EXPORTS_W void GaussianBlur InputArray src OutputArray dst Size ksize double sigmaX double sigmaY 0 int borderType BORDER_DEFAULT smooths the image using bilateral filter CV_EXPORTS_W void bilateralFilter InputArray src OutputArray dst int d double sigmaColor double sigmaSpace int borderType BORDER_DEFAULT smooths the image using the box filter Each pixel is processed in O 1 time CV_EXPORTS_W void boxFilter InputArray src OutputArray dst int ddepth Size ksize Point anchor Point 1 1 bool normalize true int borderType BORDER_DEFAULT CV_EXPORTS_W void sqrBoxFilter InputArray _src OutputArray _dst int ddepth Size ksize Point anchor Point 1 1 bool normalize true int
47. TYPES CMAKE INSTALL PREFIX CMAKE VERBOSE CUDA BUILD CUBIN CUDA BUILD EMULATION CUDA HOST COMPILER CUDA SDK ROOT DIR CUDA SEPARABLE COMPILATION CUDA TOOLKIT ROOT DIR CUDA VERBOSE BUILD EIGEN INCLUDE PATH ENABLE NEON ENABLE NOISY WARNINGS ENABLE OMIT FRAME POINTER ENABLE PRECOMPILED HEADERS ENABLE PROFILING ENABLE SOLUTION FOLDERS ENABLE VFPV3 EXECUTABLE OUTPUT PATH GIGEAPI INCLUDE PATH GIGEAPI LIBRARIES INSTALL CREATE DISTRIB INSTALL C EXAMPLES INSTALL PYTHON EXAMPLES INSTALL TO MANGLED PATHS OPENCV CONFIG FILE INCLUDE DIR OPENCV EXTRA MODULES PATH OPENCV WARNINGS ARE ERRORS OPENEXR INCLUDE PATH PVAPI INCLUDE PATH PYTHON NUMPY INCLUDE DIR PYTHON PACKAGES PATH SPHINX BUILD WITH 1394 WITH CUBLAS WITH CUDA WITH CUFFT WITH EIGEN WITH FFMPEG WITH GIGEAPI WITH GSTREAMER WITH GTK Configuraci n Raspberry Pi _EXECUTABLE NOTFOUND 2222999291 o m m CLAMDBLAS INCLUDE DIR NOTFOUND CLAMDBLAS ROOT DIR NOTFOUND CLAMDFFT INCLUDE DIR NOTFOUND CLAMDFFT ROOT I DIR NOTFOUND Release Debug Release usr local OFF OFF OFF usr bin gcc CUDA SDK ROOT DIR NOTFOUND OFF CUDA TOOLKIT ROOT DIR NOTFOUND OFF usr include eigen3 OFF OFF ON ON OFF OFF OFF home pi opencv 2 4 8 release bin GIGEAPI_INCLUDE_PATH NOTFOUND GIGEAPI_LIBRARIES NOTFOUND OFF OFF OFF OFF home pi opencv opencv 2 4 8 release OFF OPENEXR INCLUDE PATH NOTFOUND PVAPI INCLUDE PATH NOTFOUND usr lib pym
48. UREMODE T exp mode MMAL PARAMETER EXPOSURE MODE sizeof exp mode mode if camera return 1 return mmal status to int mmal port parameter set camera control amp exp mode hdr int PiCapture setAWBMode MMAL PARAM AWBMODE T awb_mode MMAL PARAMETER AWBMODE T param MMAL PARAMETER AWB MODE sizeof param amb mode if camera return 1 return mmal status to int mmal port parameter set camera control amp param hdr int PiCapture setAWBGains float gain float b MMAL PARAMETER AWB GAINS T param MMAL PARAMETER CUSTOM AWB GAINS sizeof param 0 0 0 011 if camera return 1 if r gain b gain return 0 param r gain num unsigned int r gain 65536 param b gain num unsigned int b gain 65536 param r gain den param b gain den 65536 return mmal status to int mmal port parameter set camera control amp param hdr int PiCapture setImageFX MMAL PARAM IMAGEFX T imageFX Configuraci n Raspberry Pi 44 MMAL_PARAMETER_IMAGEFX_T imgFX MMAL_PARAMETER_IMAGE_EFFECT sizeof imgFX imageFX if camera return 1 return mmal_status_to_int mmal_port_parameter_set camera gt control amp imgFX hdr int PiCapture setColourFX MMAL PARAM COLOURFX T colourFX MMAL PARAMETER COLOURFX T colfx MMAL PARAMETER COLOUR EFFECT sizeof colfx 0 0 0 if camera return 1 colfx enable colourFX enable colfx u colourFX u co
49. _HEIGHT CC_STAT_AREA CC_STAT_MAX 3 I mode of the contour retrieval algorithm enum RETR_EXTERNAL 8 lt retrieve only the most external top level contours RETR LIST 1 lt retrieve all the contours without any hierarchical information RETR CCOMP 2 lt retrieve the connected components that can possibly be nested RETR TREE 3 lt retrieve all the contours and the whole hierarchy RETR FLOODFILL 4 the contour approximation algorithm enum CHAIN APPROX NONE 1 CHAIN APPROX SIMPLE CHAIN APPROX TC89 L1 CHAIN APPROX TC89 KCOS 3 2 3 4 Variants of a Hough transform enum HOUGH_STANDARD 0 HOUGH_PROBABILISTIC HOUGH MULTI SCALE HOUGH GRADIENT 3 1 2 3 Variants of Line Segment Detector Configuraci n Raspberry Pi 77 enum LSD REFINE NONE LSD REFINE STD LSD REFINE ADV Histogram comparison enum 4 HISTCMP CORREL HISTCMP_CHISQR HISTCMP_INTERSECT HISTCMP_BHATTACHARYYA HISTCMP HELLINGER HISTCMP CHISQR ALT HISTCMP KL DIV 1 2 methods 0 1 2 3 HISTCMP_BHATTACHARYYA 4 5 the color conversion code enum COLOR BGR2BGRA COLOR_RGB2RGBA COLOR_BGRA2BGR COLOR_RGBA2RGB COLOR_BGR2RGBA COLOR_RGB2BGRA COLOR_RGBA2BGR COLOR_BGRA2RGB COLOR_BGR2RGB COLOR_RGB2BGR COLOR_BGRA2RGBA COLOR_RGBA2BGRA COLOR_BGR2GRAY COLOR_RGB2GRAY COLO
50. a 1 double beta 0 transforms array of numbers using a lookup table dst i lut src i CV_EXPORTS_W void LUT InputArray src InputArray lut OutputArray dst computes sum of array elements CV_EXPORTS_AS sumElems Scalar sum InputArray src computes the number of nonzero array elements CV EXPORTS W int countNonZero InputArray src returns the list of locations of non zero pixels CV EXPORTS W void findNonZero InputArray src OutputArray idx computes mean value of selected array elements CV EXPORTS W Scalar mean InputArray src InputArray mask noArray computes mean value and standard deviation of all or selected array elements CV EXPORTS W void meanStdDev InputArray src OutputArray mean OutputArray stddev InputArray mask noArray computes norm of the selected array part CV EXPORTS W double norm InputArray srcl int normType NORM L2 InputArray mask noArray computes norm of selected part of the difference between two arrays CV EXPORTS W double norm InputArray srcl InputArray src2 int normType NORM L2 InputArray mask noArray Configuraci n Raspberry Pi 55 computes PSNR image video quality metric CV_EXPORTS_W double PSNR InputArray srcl InputArray src2 computes norm of a sparse matrix CV_EXPORTS double norm const SparseMat amp src int normType naive nearest neighbor finder CV_EXPORTS_W void batchDistance InputArray srcl InputAr
51. a detecci n de soldadura por lo que solo se describir n las operaciones necesarias para modificar dichos par metros El c digo de esta aplicaci n se organiza en dos bloques los archivos fuente y las cabeceras Para modificar los par metros se ha de acceder al primero de ellos e Rutina principal en este archivo es donde se encuentran los par metros para ajustar la detecci n de c rculos el nivel de umbral o el rea de b squeda Para modificar estos par metros as como la resoluci n de la c mara o cualquier otro par metros de la misma deber modificarse el archivo main cpp Configuraci n Raspberry Pi 6 3 Instalaci n del sistema operativo El primer paso para poner en funcionamiento la Raspberry Pi es instalar el sistema operativo para ello en la p gina oficial de descargas de Raspberry Pi http www raspberrypi org downloads se descargar NOOBS offline and network install NOOBS NOOBS LITE Offline and network install Network install only Version 18 10 Version 1 3 10 Release date 2014 09 12 Release date 2014 09 12 More info More info Download Torrent amp Download ZIP D Download Torrent amp Download ZIP llustraci n 1 NOOBS Es un instalador que incluye los sistemas operativos mas usados y entre los que se encuentra Raspbian que sera el que usemos debido a su distribuci n Linux Una vez descargado el archivo es necesario insertar una tarjeta SD de al menos 8GB formateada
52. aking sum minimum maximum or mean value over all the rows CV EXPORTS W void reduce InputArray src OutputArray dst int dim int rtype int dtype 1 makes multi channel array out of several single channel arrays CV EXPORTS void merge const Mat mv size t count OutputArray dst makes multi channel array out of several single channel arrays Configuraci n Raspberry Pi 56 CV_EXPORTS_W void merge InputArrayOfArrays mv OutputArray dst copies each plane of a multi channel array to a dedicated array CV_EXPORTS void split const Mat amp src Mat mvbegin copies each plane of a multi channel array to a dedicated array CV_EXPORTS_W void split InputArray m OutputArrayOfArrays mv copies selected channels from the input arrays to the selected channels of the output arrays CV_EXPORTS void mixChannels const Mat src size_t nsrcs Mat dst size_t ndsts const int fromTo size_t npairs CV_EXPORTS void mixChannels InputArrayOfArrays src InputOutputArrayOfArrays dst const int fromTo size_t npairs CV_EXPORTS_W void mixChannels InputArrayOfArrays src InputOutputArrayOfArrays dst const std vector lt int gt amp fromTo extracts a single channel from src coi is based index CV_EXPORTS_W void extractChannel InputArray src OutputArray dst int coi inserts a single channel to dst coi is based index CV_EXPORTS_W void insertChannel InputArray src InputOutputArray dst int coi
53. amos y comienza a instalar Ilustraci n 3 Instalaci n terminada Configuraci n Raspberry Pi 8 4 Configuraci n b sica de la Raspberry Pi Tras el primer arranque aparece por defecto este men si no es as basta con ejecutar en la ventana de comandos sudo raspi config siendo el usuario pi y la contrase a raspberry Raspberry Pi Software Configuration Tool raspi config Setup Options xpand Filesystem Ensures that all of the SD card s Change User Password Change password for the default u Enable Boot to Desktop Scratch Choose whether to boot into a des Internationalisation Options Set up language and regional sett Enable Camera Enable this Pi to work with the R Add to Rastrack Add this Pi to the online Raspber Overclock Configure overclocking for your P Advanced Options Configure advanced settings About raspi config Information about this configurat 1 2 3 4 5 6 7 8 9 lt Select gt lt Finish gt Ilustraci n 4 Configuraci n Raspberry Pi Para moverse por el men se usar n los cursores para elegir una opci n se usa la barra espaciadora y para cambiar entre partes del men se usar el tabulador o la tecla Tab Como se ha usado NOOBS nos indica que ya ha configurado para aprovechar todo el espacio libre despu s nos da la opci n de cambiar de usuario y contrase a para ello nos abre una ventana de comandos Your partition layout is not currently supported by this You will now be asked to ent
54. an pass flags SVD NO UV Another flag SVD FULL UV indicates that the full size SVD u and SVD vt must be computed mhich is not necessary most of the time class CV EXPORTS SVD t public enum MODIFY A 1 NO_UV 2 FULL UV 4 the default constructor SVD the constructor that performs SVD SVD InputArray src int flags 0 the operator that performs SVD The previously allocated SVD u SVD w are SVD vt are released SVD amp operator InputArray src int flags Configuraci n Raspberry Pi 65 decomposes matrix and stores the results to user provided matrices static void compute InputArray src OutputArray w OutputArray u OutputArray vt int flags 8 computes singular values of a matrix static void compute InputArray src OutputArray w int flags 8 performs back substitution static void backSubst InputArray w InputArray u InputArray vt InputArray rhs OutputArray dst finds dst arg min_ dst 1 m dst static void solveZ InputArray src OutputArray dst performs back substitution so that dst is the solution or pseudo solution of m dst rhs where m is the decomposed matrix void backSubst InputArray rhs OutputArray dst const template lt typename _Tp int m int n int nm gt static void compute const Matx lt _Tp m n gt amp a Matx lt _Tp nm 1 gt amp w Matx lt _Tp m nm gt amp u Matx lt _Tp n nm gt amp v
55. ape of the structuring element enum MORPH 0 MORPH_CROSS 1 MORPH_ELLIPSE 2 E interpolation algorithm enum INTER_NEAREST 0 lt nearest neighbor interpolation INTER_LINEAR 1 lt bilinear interpolation INTER_CUBIC 2 lt bicubic interpolation INTER_AREA 3 lt area based or super interpolation INTER_LANCZOS4 4 lt Lanczos interpolation over 8x8 neighborhood INTER_MAX 7 lt mask for interpolation codes WARP_FILL_OUTLIERS 8 WARP_INVERSE_MAP 16 y enum INTER_BITS INTER_BITS2 INTER_BITS 2 INTER TAB SIZE 1 lt lt INTER_BITS INTER TAB SIZE2 INTER TAB SIZE INTER TAB SIZE Configuraci n Raspberry Pi 75 Distance types for Distance Transform and M estimators enum DIST_USER DIST_L1 DIST_L2 DIST C DIST L12 DIST FAIR DIST NELSCH DIST HUBER 1 E 3 OA UN D UN PF 7 7 id User defined distance distance x1 x2 y1 y2 the simple euclidean distance distance max x1 x2 1 2 11 12 metric distance 2 sqrt 1 x x 2 1 distance 2 106 1 c 1 3998 distance c 2 2 1 exp x c 2 c 2 9846 distance x lt 2 2 e x c 2 c 1 345 Mask size for distance transform enum DIST_MASK_3 DIST_MASK_5 DIST MASK PRECISE 3 5 0 type of the threshold operation enum THRESH_BINARY
56. apture PiCapture PiCapture int int h bool color open w h color void PiCapture open int _w int h bool color color _color width _w height _h camera 0 preview 0 camera_preview_port NULL camera_video_port NULL camera_still_port NULL preview_input_port NULL camera preview connection 8 bcm host init status mmal component create MMAL COMPONENT DEFAULT CAMERA amp camera if status MMAL SUCCESS printf Error create camera xNn status camera_preview_port camera_video_port camera still port MMAL PARAMETER CAMERA CONFIG T cam config MMAL PARAMETER CAMERA CONFIG sizeof cam config width height 0 O vidth height 3 1 MMAL TIMESTAMP MODE RESET STC mmal port parameter set camera control amp cam config hdr camera output MMAL CAMERA PREVIEW PORT camera output MMAL CAMERA VIDEO PORT camera output MMAL CAMERA CAPTURE PORT format if color format gt encoding MMAL ENCODING RGB24 format encoding variant MMAL ENCODING RGB24 else format gt encoding MMAL ENCODING 1420 format encoding variant MMAL ENCODING I420 camera video port format format es video width width format es video height height format es video crop x 0 format es video crop y 0 format es video crop width width format es video format es video crop height frame
57. are software y humanos Estos se detallan a continuaci n 1 1 1 2 1 3 Recursos hardware Los recursos hardware necesarios son e Ordenador tipo con conexi n wifi e Pantalla con entrada HDMI e Teclado y rat n con conexi n USB e Raspberry Pi e RaspiCam e Cable de red e Tarjeta SD de 4 GB m nimo Recursos softvvare Los recursos softvvare que se necesitan para el mantenimiento del proyecto son e Microsoft Windows 7 8 e Noobs 1 3 10 el cual incluye el sistema operativo Raspbian e OpenCV 2 4 8 o superior dado que las actualizaciones son constantes e PiCapture e Putty e VNC Viewer Recursos humanos El personal encargado del mantenimiento del software ha de tener conocimientos en e Lenguaje de programaci n C e Desarrollo de aplicaciones en Linux e Librer as OpenCV Configuraci n Raspberry Pi 5 2 Operaciones para la modificaci n del software El proyecto se ha desarrollado utilizando el entorno de programaci n proporcionado por la Raspberry Pi que no es m s que un editor de texto y el compilador GCC que trae instalado Esta opci n necesita de un archivo CMakeLists txt en el cual se muestren los ficheros que componen al proyecto las librer as necesarias para su correcta compilaci n y funcionamiento En este documento tambi n se pueden indicar las distintas opciones de compilaci n necesarias El objeto de este manual t cnico es el conjunto de par metros ajustables para l
58. are Configuration Tool raspi config Internationalisation Options 11 Change Locale Set up language and regional sett 12 Change Timezone Set up timezone to match your loc 13 Change Keyboard Layout Set the keyboard layout to match Ilustraci n 7 Opci n internacionalizaci n Para establecer el idioma espa ol ir pasando las opciones hasta alcanzar la que muestra la ilustraci n Configuraci n Raspberry Pi 10 Configuring locales Locales are a framework to switch between multiple languages and allow users to use their language country characters collation order etc Please choose which locales to generate UTF 8 locales should be chosen by default particularly for new installations Other character sets may be useful for backwards compatibility with older systems and software Locales to be generated lt Cancel gt Ilustraci n 8 Internacionalizaci n 2 Configuring locales Many packages in Debian use locales to display text in the correct language for the user You can choose a default locale for the system from the generated locales This will select the default language for the entire system If this system is a multi user system where not all users are able to speak the default language they will experience difficulties Default locale for the system environment None en US UTF 8 e S UTF 8 lt Cancel gt Ilustraci n 9 Internacionalizaci n 3 Tras aceptar esta opci
59. ate lt gt struct ParamType lt float gt typedef float const param type typedef float member type enum type Param FLOAT E template lt gt struct ParamType lt unsigned gt typedef unsigned const param type typedef unsigned member type enum type Param UNSIGNED INT template lt gt struct ParamType lt uint64 gt typedef uint64 const param type typedef uint64 member type enum type Param UINT64 template lt gt struct ParamType lt uchar gt typedef uchar const param type typedef uchar member type enum type Param UCHAR J y namespace cv include opencv2 core operations hpp include opencv2 core cvstd inl hpp include opencv2 core utility hpp include opencv2 core optim hpp endif OPENCV CORE HPP Configuraci n Raspberry Pi 74 8 3 3 Imgproc hpp Es el m dulo que incluye el procesamiento de imagen el filtrado lineal y no lineal las transformaciones geom tricas re escalado transformaciones afines conversi n de espacio de color histogramas y un largo etc tera C digo ifndef OPENCV IMGPROC HPP amp define _ OPENCV IMGPROC HPP tinclude opencv2 core hpp namespace cv Namespace where all the C OpenCV functionality resides I namespace cv type of morphological operation enum MORPH ERODE 0 MORPH_DILATE 1 MORPH_OPEN 2 MORPH_CLOSE 3 MORPH_GRADIENT 4 MORPH_TOPHAT 5 MORPH_BLACKHAT 6 E sh
60. ay dst InputArray mask noArray int dtype 1 subtracts one matrix from another dst srcl src2 CV_EXPORTS_W void subtract InputArray srcl InputArray src2 OutputArray dst InputArray mask noArray int dtype 1 computes element wise weighted product of the two arrays dst scaletsrcitsrc2 CV_EXPORTS_W void multiply InputArray srcl InputArray src2 OutputArray dst double scale 1 int dtype 1 Configuraci n Raspberry Pi 54 computes element wise weighted quotient of the two arrays dst scale src1 src2 CV_EXPORTS_W void divide InputArray srcl InputArray src2 OutputArray dst double scale 1 int dtype 1 computes element wise weighted reciprocal of an array dst scale src2 CV_EXPORTS_W void divide double scale InputArray src2 OutputArray dst int dtype 1 adds scaled array to another one dst alpha src1 src2 CV_EXPORTS_W void scaleAdd InputArray src1 double alpha InputArray src2 OutputArray dst computes weighted sum of two arrays dst alpha src1 beta src2 gamma CV EXPORTS void addWeighted InputArray srcl double alpha InputArray src2 double beta double gamma OutputArray dst int dtype 1 scales array elements computes absolute values and converts the results to 8 bit unsigned integers dst i saturate_cast lt uchar gt abs src i alpha beta CV_EXPORTS_W void convertScaleAbs InputArray src OutputArray dst double alph
61. ble aeps checks if the point is inside the contour Optionally computes the signed distance from the point to the contour boundary CV_EXPORTS_W double pointPolygonTest InputArray contour Point2f pt bool measureDist Configuraci n Raspberry Pi 98 computes whether two rotated rectangles intersect and returns the vertices of the intersecting region CV_EXPORTS_W int rotatedRectangleIntersection const RotatedRect amp recti const RotatedRect amp rect2 OutputArray intersectingRegion CV_EXPORTS_W Ptr lt CLAHE gt createCLAHE double clipLimit 40 0 Size tileGridSize Size 8 8 Ballard D H 1981 Generalizing the Hough transform to detect arbitrary shapes Pattern Recognition 13 2 111 122 Detects position only without traslation and rotation CV_EXPORTS Ptr lt GeneralizedHoughBallard gt createGeneralizedHoughBallard Guil N Gonz lez Linares J M and Zapata E L 1999 Bidimensional shape detection using an invariant approach Pattern Recognition 32 6 1025 1038 Detects position traslation and rotation CV_EXPORTS Ptr lt GeneralizedHoughGuil gt createGeneralizedHoughGuil Performs linear blending of two images CV_EXPORTS void blendLinear InputArray srcl InputArray src2 InputArray weights1 InputArray weights2 OutputArray dst enum COLORMAP_AUTUMN COLORMAP BONE 1 COLORMAP JET 2 COLORMAP_WINTER 3 COLORMAP RAINBON 4 COLORMAP OCEAN 5 COLORMAP
62. borderType BORDER_DEFAULT a synonym for normalized box filter CV_EXPORTS_W void blur InputArray src OutputArray dst Size ksize Point anchor Point 1 1 int borderType BORDER DEFAULT applies non separable 2D linear filter to the image CV_EXPORTS_W void filter2D InputArray src OutputArray dst int ddepth InputArray kernel Point anchor Point 1 1 double delta 0 int borderType BORDER_DEFAULT applies separable 2D linear filter to the image CV_EXPORTS_W void sepFilter2D InputArray src OutputArray dst int ddepth InputArray kerne1X InputArray kernelY Point anchor Point 1 1 double delta 8 int borderType BORDER_DEFAULT applies generalized Sobel operator to the image CV_EXPORTS_W void Sobel InputArray src OutputArray dst int ddepth int dx int dy int ksize 3 double scale 1 double delta 0 int borderType BORDER_DEFAULT applies the vertical or horizontal Scharr operator to the image CV_EXPORTS_W void Scharr InputArray src OutputArray dst int ddepth int dx int dy double scale 1 double delta 0 int borderType BORDER_DEFAULT Configuraci n Raspberry Pi 89 applies Laplacian operator to the image CV_EXPORTS_W void Laplacian InputArray src OutputArray dst int ddepth int ksize 1 double scale 1 double delta 8 int borderType BORDER DEFAULT applies Canny edge detector and produces the edge map CV EXPORTS W void
63. clude directories opt vc userland host applications linux libs bcm host include include directories opt vc userland host applications linux apps raspicam gl scenes include directories opt vc userland interface vcos include directories opt vc userland include directories opt vc userland vcos pthreads include directories opt vc userland interface vmcs host linux include directories opt vc userland interface khronos include include directories opt vc userland interface khronos common add executable camcv RaspiCamControl c RaspiCLI c RaspiPreview c camcv c RaspiTex c RaspiTexUtil c gl_scenes yuv c gl_scenes sobel c tga c gl scenes teapot c gl scenes models c gl scenes square c gl scenes mirror c target link libraries camcv opt vc lib libmmal core so opt vc lib libmmal util so opt vc lib libmmal vc client so opt vc lib libvcos so opt vc lib libbcm host so opt vc lib libGLESv2 so opt vc lib libEGL so usr lib arm linux gnueabihf libpthread so usr lib arm linux gnueabihf libm so OpenCV LIBS Ilustraci n 31 CMakeLists txt 3 Borrar el directorio CMakeFiles si existe 4 Compilar y probar si funciona cmake make camcv t 1000 No deber a dar problema alguno Configuraci n Raspberry Pi 28 7 3 Paso 3 Mostrar una imagen Es el ltimo paso antes de comprobar que todas las librer as est n bien conectadas Para ello se han se seguir estos pasos 1 Descargar el c digo de este enlace h
64. e and returns the next 32 bit unsigned integer random number unsigned next operator uchar operator schar operator ushort operator short operator unsigned returns a random integer sampled uniformly from 8 N unsigned operator unsigned N unsigned operator operator int operator float operator double returns uniformly distributed integer random number from a b range int uniform int a int b returns uniformly distributed floating point random number from a b range float uniform float a float b returns uniformly distributed double precision floating point random number from a b range double uniform double a double b void fill InputOutputArray mat int distType InputArray a InputArray b bool saturateRange false returns Gaussian random variate with mean zero double gaussian double sigma Configuraci n Raspberry Pi 67 uint64 state class CV_EXPORTS RNG_MT19937 t public RNG_MT19937 RNG_MT19937 unsigned s void seed unsigned s unsigned next operator int operator unsigned operator float operator double unsigned operator unsigned N unsigned operator returns uniformly distributed integer random number from a b range int uniform int a int b returns uniformly distributed floating point random number from a b range float uniform float a float b returns uniformly
65. ed point CV EXPORTS W int floodFill InputOutputArray image InputOutputArray mask Point seedPoint Scalar newVal CV OUT Rect rect 0 Scalar loDiff Scalar Scalar upDiff Scalar int flags 4 converts image from one color space to another CV EXPORTS void cvtColor InputArray src OutputArray dst int code int dstCn main function for all demosaicing procceses CV_EXPORTS_W void demosaicing InputArray _src OutputArray _dst int code int den 0 Configuraci n Raspberry Pi 96 computes moments of the rasterized shape or a vector of points CV_EXPORTS_W Moments moments InputArray array bool binarylmage false computes 7 Hu invariants from the moments CV_EXPORTS void HuMoments const Moments amp moments double hu 7 CV_EXPORTS_W void HuMoments const Moments amp m OutputArray hu computes the proximity map for the raster template and the image where the template is searched for CV_EXPORTS_W void matchTemplate InputArray image InputArray templ OutputArray result int method computes the connected components labeled image of boolean image image with 4 or 8 way connectivity returns N the total number of labels N 1 where 0 represents the background label ltype specifies the output label image type an important consideration based on the total number of labels or alternatively the total number of pixels in the source image CV EXPORTS
66. el siguiente comando sed i s if DEFINED CMAKE TOOLCHAIN FILE if NOT DEFINED CMAKE TOOLCHAIN FILE g makefiles cmake arm linux cmake 4 Crearun directorio y compilarlo lleva un rato sudo mkdir build cd build sudo cmake DCMAKE BUILD TYPE Release sudo male sudo make install No deber a de dar ning n fallo aunque es probable que en 3 s esto depende de la versi n de Raspbian instalada y de la versi n subida a GitHub del documento en el que se est trabajando en caso de que de fallo no pasa nada se puede continuar sin problemas Configuraci n Raspberry Pi 27 7 2 Paso 2 Crear el primer proyecto Este proyecto solo servir para unir las librer as de OpenCV y las mmal 1 Crear un nuevo archivo donde se copiar uno de los ejemplos que vienen con las librer as en el directorio que queramos en este caso ser el directorio por defecto home pi Se crea un nuevo directorio donde se copiar el ejemplo cd home pi mkdir camcv se le puede poner cualquier nombre pero ojo con los directorios cd camcv cp opt vc userland host_applications Linux apps raspicam mv RaspiStill c camcv c cambia el nombre al archivo se puede poner otro pero ojo sudo chmod 777 camcv c este comando puede no ser necesario 2 Modificar el archivo CMakeLists txt y dejarlo como la ilustraci n 31 Emake minimum required VERSION 2 8 project camcv SET COMPILE DEFINITIONS Werror 0PENCV find_package OpenCV REQUIRED in
67. else cout lt lt Frame dropped lt lt endl time getTickCount t 0 getTickFrequency cout lt lt frames time lt lt fps lt lt endl return 0 Configuraci n Raspberry Pi 34 8 1 2 Clase PiCapture Es la definici n de la clase y de los m todos que se encargan de configurar la RaspiCam de capturar la imagen y de ajustar todos los par metros para poder modificar la toma de im genes por ejemplo ajustando la saturaci n el contraste o el brillo C digo de la cabecera cap h include include include include include include include lt stdio h gt lt opencv2 opencv hpp gt interface mmal mmal h interface mmal util mmal default components h interface mmal util mmal connection h interface mmal util mmal util h interface mmal util mmal util params h class PiCapture private camera MMAL COMPONENT T camera MMAL COMPONENT T preview MMAL ES FORMAT T format MMAL STATUS T status MMAL PORT T camera preview port camera video port still port MMAL PORT T preview input port MMAL CONNECTION T camera preview connection bool color public static cv Mat image static int width height static MMAL POOL T camera video port pool static void set image cv Mat image image _image PiCapture PiCapture int int bool void open int int bool cv Mat grab return image settings typedef struct int enable Turn colo
68. en a s del 5 A decanedbi trav s de la conexi n a Intemet de este equipo Conexi n de red dom stica acceso Internet Conexi n de rea local SSID Guest es alll Conexi n de red inal mbrica Duraci n 08 54 29 Guest V Permitir que los usuarios de otras redes controlen o Velocidad 54 0 Mbps Calidad de se al E deshabiliten la conexi n compartida a Intemet Usar Conexi n compartida a Intemet acceso Sin acceso a la red ICS es VirtualBox Host Only Network Enviados A Recibidos Bytes 132 290 688 950 659 804 acceso telef nico ad hoc o VPN bien E Propiedades fs Deshabitar Dagnostcar Cerrar al mbrica cableada de acceso telef nico llustraci n 18 Conexiones En Uso compartido activar Permitir que los usuarios de otras redes se conectes a trav s de la conexi n a Internet de este equipo Despu s buscar en Conexi n de red dom stica la conexi n de red que tiene la Raspberry Pi deber a ser la Ethernet que est libre en este caso es Conexi n de rea local Paso 3 se repite el paso uno y se selecciona el puerto el puerto al que est conectado la Raspberry Pi en la ilustraci n 19 Conexi n de rea local Clicar en Propiedades despu s en Esta conexi n usa los siguientes elementos seleccionar Protocolo de Internet versi n 4 TCP IP En este caso se asigna la direcci n 192 16
69. encv git e Una vez descargado se descomprime unzip opencv 2 4 8 zip el nombre dependera de la versi n que se haya descargado e Cambiamos el directorio a la carpeta descomprimida cd opencv 2 4 8 e Dentro de este directorio creamos otro mkdir release y nos cambiamos a ese directorio cd rel ase e Una vez en este directorio ejecutamos la configuraci n previa para una correcta instalaci n u un ccmake Para configurar se teclea c y se dejan las opciones como la ilustraci n 29 Una Mil vez est n todas correctas se teclea de nuevo c para configurarlo y despu s g para generar el archivo Makefile Configuraci n Raspberry Pi 24 ANT_EXECUTABLE BUILD_DOCS BUILD_EXAMPLES BUILD_JASPER BUILD_JPEG BUILD_OPENEXR BUILD_PACKAGE BUILD_PERF_TESTS BUILD_PNG BUILD_SHARED_LIBS BUILD_TBB BUILD_TESTS BUILD_TIFF BUILD_WITH_DEBUG_INFO BUILD ZLIB BUILD opencv apps BUILD opencv calib3d BUILD opencv contrib BUILD opencv core BUILD opencv features2d BUILD opencv flann BUILD opencv gpu BUILD opencv highgui BUILD opencv imgproc BUILD opencv legacy BUILD opencv ml BUILD opencv nonfree BUILD opencv objdetect BUILD opencv ocl BUILD opencv photo BUILD opencv python BUILD opencv stitching BUILD opencv superres BUILD opencv ts BUILD opencv video BUILD opencv videostab BUILD opencv world CLAMDBLAS INCLUDE DIR CLAMDBLAS ROOT DIR CLAMDEET INCLUDE DIR CLAMDFFT ROOT I DIR CMAKE BUILD TYPE CMAKE 1 CONFIGURATION
70. entana de comandos de la Raspberry Pi Terminal introducir este comando sudo nano etc network interfaces Esto abre un archivo que se ha de modificar hasta que quede de como la ilustraci n 20 una vez modificado para guardarlo basta con pulsar Ctrl X y acto seguido Y S depende si el idioma es ingl s o espa ol Configuraci n Raspberry Pi 18 File etc network interfaces llustraci n 20 Direcci n est tica Raspberry Pi Paso 2 sirve para comprobar que toda la configuraci n est correcta para ello introducir en la l nea de comandos sudo nano etc resolv conf Al igual que antes abre un fichero se comprueba si est como la ilustraci n 21 una vez modificado guardarlo como anteriormente File etc resolv conf llustraci n 21 Comprobaci n configuraci n Paso 3 reiniciar la Raspberry Pi para que los cambios hagan efecto sudo reboot 5 1 3 Comprobar el xito de la conexi n Desde la ventana de comandos de Windows realizar un ping a la direcci n de la Raspberry Pi ping 192 168 137 2 Desde el terminal de la Raspberry Pi realizar un ping a la direcci n del ordenador ping 192 168 137 1 para detener la ejecuci n basta con pulsar Crtl C Configuraci n Raspberry Pi 19 5 2 Conexi n remota a la Raspberry Pi usando SSH 5 2 1 Activaci n del servicio SSH en la Raspberry Pi Si durante la instalaci n se activ este servicio no es necesario este paso sino es as basta con ejecutar estos comand
71. er a new password for the pi tool You are probably using NOOBS in which case your user root filesystem is already expanded anyway Ilustraci n 5 Partici n y contrase a Estas son las opciones 1 y 2 del men a las que se puede volver en cualquier momento Configuraci n Raspberry Pi 9 La tercera opci n nos permite seleccionar el arranque de la Raspberry Pi que sea en consola de texto Console Text en escritorio Desktop o el entorno para aprender a programar para ni os Scratch Raspberry Pi Software Configuration Tool raspi config Setup Options 1 Expand Filesystem Ensures that all of the SD card s 2 Change User Password Change password for the default u 3 Enable Boot to Desktop Scratch ose whether to boot 4 Internationalisation Options Set up language and regional sett 5 Enable Camera Enable this Pi to work with the R 6 Add to Rastrack Add this Pi to the online Raspber 7 Overclock Configure overclocking for your P 8 Advanced Options Configure advanced settings 9 About raspi config Information about this configurat lt Finish gt lt Select gt Chose boot option Console Text console requiring login default Desktop Log in as user pi at the graphical desktop Scratch Start the Scratch programming environment upon boot Ilustraci n 6 Opci n escritorio La opci n numero 4 nos permite establecer el idioma la zona horaria y configurar el teclado Raspberry Pi Softw
72. go key lt Cancel gt Configuraci n Raspberry Pi 12 Configuring Reyboard configuration By default the combination Control Alt Backspace does nothing If you want it can be used to terminate the X server Use Control Alt Backspace to terminate the X server llustraci n 11 Configuraci n teclado En el caso de que queramos manejar la RaspiCam hemos de habilitarla que es la opci n 5 del men Enable support for Raspberry Pi camera lt Enable gt llustraci n 12 Habilitar RaspiCam La opci n 6 nos permite a adir Rastrack que registra en un mapa donde est nuestra RaspberryPi La opci n 7 nos permite hacerle un Overclock a la Raspberry Pi nos advierte que puede hacer inestable a la Raspberry Pi Desde la experiencia no se nota demasiado el hac rselo o no Chose overclock preset None 700MHz ARM 250MHz 400MHz overvolt Modest 800MHz ARM 250MHz 400MHz overvolt Medium 900MHz ARM AM overvolt 950MHz ARM 250MHz core 450MHz SDRAM overvolt 1000MHz ARM 500MHz core 600MHz SDRAM 6 overvolt Cancel Ilustraci n 13 Overclock Configuraci n Raspberry Pi 13 La opci n n mero 8 son las opciones avanzadas son 7 n Raspberry Pi Software Configuration Tool raspi config Advanced Options Overscan You may need to configure oversca A2 Hostname Set the visible name for this Pi A3 Memory Split Change the amount of memory made A4 SSH Enable Disable remote c
73. ice or address printf I O error break printf Illegal seek break printf Data is corrupt Nattention FIXME printf Component is not ready Nattention printf Component is not configured attention FIXME not POSIX break case break case case Try again later case MMAL_EISCONN MMAL_ENOTCONN MMAL_EAGAIN break MMAL_EFAULT default return 1 printf Port is already connected printf Port is disconnected break printf Resource temporarily unavailable printf Bad address break printf Unknown status error break static void color_callback MMAL_PORT_T MMAL_BUFFER_HEADER_T static void gray_callback MMAL_PORT_T MMAL_BUFFER_HEADER_T Configuraci n Raspberry Pi 38 C digo de la definici n PiCapture cpp modified by George Profenza based on the OpenCV 2 x C wrapper written by Samarth Manoj Brahmbhatt University of Pennsylvania include lt stdio h gt include lt stdlib h gt include lt opencv2 opencv hpp gt include bcm_host h include interface mmal mmal h include interface mmal util mmal_default_components h include interface mmal util mmal_connection h include interface mmal util mmal_util h include interface mmal util mmal_util_params h include cap h define MMAL CAMERA PREVIEN PORT 0 define MMAL CAMERA VIDEO PORT 1 define MMAL CAMERA CAPTURE PORT 2 using namespace cv using namespace std
74. ies main mmal core mmal_util vc client bcm host OpenCV_LIBS Configuraci n Raspberry Pi 47 8 3 OpenCV A continuaci n se mostrar n los archivos de OpenCV utilizados para el correcto funcionamiento del proyecto 8 3 1 Highgui hpp La librer a highgui de OpenCV resuelve un gran n mero de problemas relacionados con la entrada salida y con el interface de usuario Una utilidad muy importante es la capacidad de asignar acciones a los eventos del rat n sobre las ventanas de highgui crear barras de posici n u ofrecer funciones para entrada y salida de v deo C digo ifndef OPENCV HIGHGUI HPP define _ OPENCV HIGHGUI HPP tinclude home pi opencv modules core include opencv2 core core hpp include home pi opencv modules imgcodecs include opencv2 imgcodecs imgcodecs hpp include home pi opencv modules videoio include opencv2 videoio videoio hpp graphical user interface namespace cv Flags for namedWindow enum WINDOW NORMAL 0x00000000 the user can resize the window no constraint also use to switch a fullscreen window to a normal size WINDOW AUTOSIZE 0x00000001 the user cannot resize the window the size is constrainted by the image displayed WINDOW OPENGL 0x00001000 window with opengl support WINDOW FULLSCREEN 1 change the window to fullscreen WINDOW FREERATIO 0x00000100 the image expends as much as it can
75. l void setXi double xi 0 virtual double getXi const 0 Feature table levels virtual void setLevels int levels 0 virtual int getLevels const 0 Maximal difference between angles that treated as equal virtual void setAngleEpsilon double angleEpsilon 0 virtual double getAngleEpsilon const 0 Minimal rotation angle to detect in degrees virtual void setMinAngle double minAngle 8 virtual double getMinAngle const 0 Maximal rotation angle to detect in degrees virtual void setMaxAngle double maxAngle 0 virtual double getMaxAngle const 0 Angle step in degrees virtual void setAngleStep double angleStep 8 virtual double getAngleStep const 0 Angle votes threshold virtual void setAngleThresh int angleThresh 8 virtual int getAngleThresh const 8 Minimal scale to detect virtual void setMinScale double minScale 0 virtual double getMinScale const 0 Maximal scale to detect virtual void setMaxScale double maxScale 0 virtual double getMaxScale const 0 Scale step virtual void setScaleStep double scaleStep 0 virtual double getScaleStep const 0 Configuraci n Raspberry Pi 84 Scale votes threshold virtual void setScaleThresh int scaleThresh 0 virtual int getScaleThresh const 0 Position votes threshold virtual void setPosThresh int posThresh 8 virtual int getPosThresh const 0
76. lfx v colourFX v return mmal status to int mmal port parameter set camera control amp colfx hdr int PiCapture setRotation int rotation int ret int my_rotation rotation 360 90 90 ret mmal port parameter set int32 camera output 0 MMAL PARAMETER ROTATION my rotation mmal port parameter set int32 camera output 1 MMAL PARAMETER ROTATION my rotation mmal port parameter set int32 camera output 2 MMAL PARAMETER ROTATION my rotation return ret int PiCapture setFlips int hflip int vflip MMAL PARAMETER MIRROR T mirror MMAL_PARAMETER_MIRROR sizeof MMAL PARAMETER MIRROR T MMAL PARAM MIRROR NONE if hflip amp amp vflip mirror value MMAL PARAM MIRROR BOTH else if hflip mirror value MMAL PARAM MIRROR HORIZONTAL else if vflip mirror value MMAL PARAM MIRROR VERTICAL mmal port parameter set camera output 0 amp mirror hdr mmal port parameter set camera output 1 amp mirror hdr Configuraci n Raspberry Pi 45 return mmal_port_parameter_set camera gt output 2 amp mirror hdr int PiCapture setROI PARAM FLOAT RECT T rect MMAL PARAMETER INPUT CROP T crop MMAL PARAMETER INPUT CROP sizeof MMAL PARAMETER INPUT CROP T if rect x lt 0 rect x O if rect x gt 1 rect x 1 if rect y lt 0 rect y 0 if rect y gt 1 rect y 1 if rect w lt 0 rect w 0 if rect w gt 1 rect w 1 lt lt if rect h l
77. lt Point2f gt 8 facetCenters CV_WRAP Point2f getVertex int vertex CV OUT int firstEdge 0 const CV WRAP int getEdge int edge int nextEdgeType const CV_WRAP int nextEdge int edge const CV WRAP int rotateEdge int edge int rotate const CV_WRAP int symEdge int edge const CV_WRAP int edgeOrg int edge CV_OUT Point2f orgpt 8 const CV_WRAP int edgeDst int edge CV_OUT Point2f dstpt 8 const protected int newEdge void deleteEdge int edge int newPoint Point2f pt bool isvirtual int firstEdge void deletePoint int vtx void setEdgePoints int edge int orgPt int dstPt void splice int edgeA int edgeB int connectEdges int edgeA int edgeB void swapEdges int edge int isRightof Point2f pt int edge const void calcVoronoi void clearVoronoi void checkSubdiv const struct CV_EXPORTS Vertex Vertex Vertex Point2f pt bool _isvirtual int _firstEdge bool isvirtual const bool isfree const int firstEdge int type Point2f pt LE struct CV EXPORTS QuadEdge 1 QuadEdge QuadEdge int edgeidx bool isfree const int next 4 int pt 4 LE Configuraci n Raspberry Pi 86 std vector Vertex vtx std vector QuadEdge qedges int freeQEdge int freePoint bool validGeometry int recentEdge Point2f topLeft Point2f bottomRight class CV_EXPORTS_W LineSegmentDetector public Algorithm t public Detect lines in the inp
78. lue bool readOnly false int Algorithm getter 0 void Algorithm setter int 0 const String amp help String void addParam Algorithm amp algo const char name double amp value bool readOnly false double Algorithm getter 0 void Algorithm setter double 0 const String amp help String void addParam Algorithm amp algo const char name String amp value bool readOnly false String Algorithm getter 0 void Algorithm setter const String amp 0 const String amp help String void addParam Algorithm amp algo const char name Mat amp value bool readOnly false Mat Algorithm getter 0 void Algorithm setter const Mat amp 0 const String amp help String void addParam Algorithm amp algo const char name std vector lt Mat gt amp value bool readOnly false std vector lt Mat gt Algorithm getter 0 Configuraci n Raspberry Pi 71 void Algorithm setter const std vector lt Mat gt amp 0 const String amp help String void addParam Algorithm amp algo const char name Ptr lt Algorithm gt amp value bool readOnly false Ptr lt Algorithm gt Algorithm getter 0 void Algorithm setter const Ptr lt Algorithm gt 8 0 const String amp help String void addParam Algorithm amp algo const char name float amp value bool readOnly false float Algorithm getter 0 void Algorithm setter float 0 const String amp help
79. m KMEANS RANDOM CENTERS 0 Chooses random centers for k Means initialization KMEANS PP CENTERS 2 Uses k Means algorithm for initialization KMEANS USE INITIAL LABELS Means initialization enum FILLED 1 1 Uses the user provided labels for K Configuraci n Raspberry Pi 53 LINE_4 LINE_8 LINE_AA enum FONT HERSHEY SIMPLEX FONT_HERSHEY_PLAIN FONT HERSHEY DUPLEX FONT_HERSHEY_COMPLEX FONT_HERSHEY_TRIPLEX FONT HERSHEY COMPLEX SMALL FONT HERSHEY SCRIPT SIMPLEX FONT HERSHEY SCRIPT COMPLEX FONT ITALIC H n H e eo v w amp P U E Or enum REDUCE_SUM REDUCE AVG REDUCE MAX REDUCE MIN II UN Ho swaps two matrices CV_EXPORTS void swap Mat amp a Mat amp b swaps two umatrices CV_EXPORTS void swap UMat amp a UMat amp b 1D interpolation function returns coordinate of the donor pixel for the specified location p CV_EXPORTS_W int borderInterpolate int p int len int borderType copies 2D array to a larger destination array with extrapolation of the outer part of src using the specified border mode CV_EXPORTS_W void copyMakeBorder InputArray src OutputArray dst int top int bottom int left int right int borderType const Scalar amp value Scalar adds one matrix to another dst srcl src2 CV EXPORTS void add InputArray srcl InputArray src2 OutputArr
80. mally the constuctor is not called explicitly Instead the macros CV Error CV Error and CV Assert are used Exception int _code const String amp _ const String amp _func const String amp _file int _line virtual lt Exception throw fel Nreturn the error description and the context as a text string aw Configuraci n Raspberry Pi 52 virtual const char what const throw void formatMessage String msg lt the formatted error message int code lt error code see CVStatus String err lt error description String func lt function name Available only when the compiler supports getting it String file lt source file name where the error has occured int line lt line number in the source file where the error has occured Signals an error and raises the exception bab By default the function prints information about the error to stderr then it either stops if setBreakOnError had been called before or raises the exception It is possible to alternate error processing by using redirectError Nparam exc the exception raisen gi TODO drop this version CV EXPORTS void error const Exception amp exc enum SORT EVERY ROW 0 SORT_EVERY_COLUMN 1 SORT_ASCENDING 0 SORT_DESCENDING 16 enum COVAR_SCRAMBLED 8 COVAR_NORMAL 1 COVAR_USE_AVG 2 COVAR_SCALE 4 COVAR_ROWS 8 COVAR_COLS 16 P k Means flags 7 enu
81. maxCorners double qualityLevel double minDistance InputArray mask noArray int blockSize 3 bool useHarrisDetector false double k 0 04 finds lines in the black n white image using the standard or pyramid Hough transform CV EXPORTS W void HoughLines InputArray image OutputArray lines double rho double theta int threshold Configuraci n Raspberry Pi 90 double srn 8 double stn 0 double min_theta 0 double max theta CV PI finds line segments in the black n white image using probabilistic Hough transform CV_EXPORTS_W void HoughLinesP InputArray image OutputArray lines double rho double theta int threshold double minLineLength 8 double maxLineGap 0 finds circles in the grayscale image using 2 1 gradient Hough transform CV_EXPORTS_W void HoughCircles InputArray image OutputArray circles int method double dp double minDist double paraml 100 double param2 100 int minRadius 0 int maxRadius 0 erodes the image applies the local minimum operator CV_EXPORTS_W void erode InputArray src OutputArray dst InputArray kernel Point anchor Point 1 1 int iterations 1 int borderType BORDER_CONSTANT const Scalar amp borderValue morphologyDefaultBorderValue dilates the image applies the local maximum operator CV_EXPORTS_W void dilate InputArray src OutputArray dst InputArray kernel Point anchor Point 1 1 int iterations
82. minar la vista previa de la imagen PR we don t want preview state camera_component gt output MMAL_CAMERA_PREVIEW_PORT D D 1 nasema mame l if create_camera_component amp state vcos_log_error s Failed to create camera component func else if status raspipreview create amp state preview parameters MMAL SUCCESS vcos log error s Failed to create preview component _ func destroy camera component amp state PR we don t want preview Connect camera to preview status connect ports camera preview port preview input port amp state preview connection PR we don t want preview 1f state preview_parameters wantPreview mmal_connection_destroy state preview_connection llustraci n 35 Eliminar vista previa 6 Compilar y ejecutar cmake make camcv 1000 camcvWin Ilustraci n 36 Captura de imagen En este paso no es habitual la presencia de errores Aunque se podr a trabajar de esta manera resulta muy complicado por lo que se ver otra forma m s f cil este c digo es dif cil de leer y de integrar la captura de imagen en el c digo Configuraci n Raspberry Pi 30 7 4 Paso 4 Proyectos visi n El c digo de los pasos anteriores es complicado de entender y de leer por lo que como base para los proyectos de visi n se emplear la ltima versi n de PiCapture disponible en este e
83. n sale de nuevo la terminal y termina de configurarse Para la configuraci n de la zona horaria Configuring tzdata Please select the city or region corresponding to your time zone Configuring tzdata Please select the geographic area in which you live Subsequent configuration questions will narrow this down by presenting a list of cities representing the time zones in which they are located Time zone Geographic area Lisbon t Ljubljana Asia 1 London Atlantic Ocean Luxembour harta Indian Ocean Malta Pacific Ocean a Mariehamn System V timezones I Minsk us Monaco None of the above 4 Moscow 1 Ok Cancel Cancel Ilustraci n 10 Zona horaria Configuraci n Raspberry Pi 11 Para la configuraci n del teclado basta con buscar uno gen rico sino encontramos el modelo exacto e idioma establecemos espa ol Al acabar vuelve a salir el Terminal mientras termina de configurarse Configuring keyboard configuration Please select the model of the keyboard of this machine Keyboard model Laptop notebook Compaq eg Presario Internet Keyboard Laptop notebook eMachines m68xx Logitech Access Keyboard ech Cordless Desktop Logitech Cordless Desktop alternate option Logitech Cordless Desktop EX110 Logitech Cordless Desktop iTouch Logitech Cordless Desktop LX 300 Logitech Cordless Desktop Navigator Logitech Cordless Desktop Optical e ny lt
84. n con el nombre que queramos Basic options for your Pu T T Y session Specify the destination you want to connect to Host Name or IP address Port 192 168 137 2 22 Connection type Raw Telnet Rlogin SSH Serial Load save or delete a stored session Saved Sessions RaspbemyPi as Proxy 6 SSH i Serial Close window on exit Always Never Only on clean exit Ga llustraci n 25 Configuraci n Putty con IP RasPi Configuraci n Raspberry Pi 21 Para utilizar la conexi n basta con hacer doble click sobre el nombre de la que queramos usar o clicar en el nombre y despu s en Open Al abrir la conexi n nos pide el usuario y la contrase a que hayamos establecido a nuestra Raspberry Pi as se habilita el terminal de la Raspberry llustraci n 26 Conexi n con Raspberry Pi Configuraci n Raspberry Pi 22 5 3 Conexi n remota a la Raspberry Pi usando VNC La conexi n SSH con el terminal tiene algunos inconvenientes a la hora de trabajar y programar por ello se configurar la conexi n para poder ver el escritorio de la Raspberry Pi 5 3 1 Instalaci n VNC en la Raspberry Pi Lo primero es instalar el servidor VNC en la Raspberry este carga el escritorio remoto Conectamos la Raspberry Pi al Pc mediante Putty y se ejecuta sudo apt get install tightvncserver Una vez instalado para ejecutarlo basta con ejecutar el comando vncserver
85. ng 0 Principal Component Analysis The class PCA is used to compute the special basis for a set of vectors The basis will consist of eigenvectors of the covariance matrix computed from the input set of vectors After PCA is performed vectors can be transformed from the original high dimensional space to the subspace formed by a few most prominent eigenvectors called the principal components corresponding to the largest eigenvalues of the covariation matrix Thus the dimensionality of the vector and the correlation between the coordinates is reduced The following sample is the function that takes two matrices The first one stores the set of vectors a row per vector that is used to compute PCA the second one stores another test set of vectors a row per vector that are first compressed with PCA then reconstructed back and then the reconstruction error norm is computed and printed for each vector code using namespace cv PCA compressPCA const Mat amp pcaset int maxComponents const Mat amp testset Mat amp compressed PCA pca pcaset pass the data Mat we do not have a pre computed mean vector so let the PCA engine to compute it PCA DATA_AS ROW indicate that the vectors are stored as matrix rows use PCA DATA AS COL if the vectors are the matrix columns maxComponents specify how many principal components to retain if there is no test data just return the
86. nlace https github com orgicus PiCapture Es un proyecto simple que une las librer as de OpenCV con el uso de la RaspiCam Para trabajar con l se puede descargar directamente o ejecutar los siguientes comandos en el directorio que queramos trabajar git clone https github comraspberrypi userland git reemplazar en CMakeLists txt USERLAND DIR por el directorio en el que se est trabajando cmake make main Por defecto captura las im genes en escala de grises aunque se puede cambiar con un par metro en la llamada a cap open PiCapture Ilustraci n 37 Ejemplo captura El mayor problema usando este ejemplo si se quiere usar lenguaje C como base es el tipo de variable en la que almacena la imagen que captura la c mara esta es de tipo Mat y la mayor a de funciones de OpenCV trabajan con pLImage Esto es un problema ya que no existe transformaci n directa entre un tipo y otro para facilitar el trabajo Para poder trabajar ha de hacerse de la siguiente manera Configuraci n Raspberry Pi 31 cap open 640 480 isColor 7 true false Mat 1m IplImage binar IplImage malloc sizeof IplImage im cap grab IplImage frame im cvThreshold amp trame binar Umbral 255 CV THRESH BINARY cvShowImaae PiCapture amp frame cvShowImage Circles binar Ilustraci n 38 Ipllmage amp Mat ejemplo La captura se almacena en una variable tipo Mat se crea una variable tipo necesaria para
87. no ratio constraint WINDOW KEEPRATIO 0x00000000 the ratio of the image is respected y Flags for set getWindowProperty enum WND_PROP_FULLSCREEN 8 fullscreen property can be WINDOW NORMAL or WINDOW FULLSCREEN WND PROP AUTOSIZE 1 autosize property can be WINDOW NORMAL or WINDOW AUTOSIZE WND PROP ASPECT RATIO 2 window s aspect ration can be set to WINDOW FREERATIO or WINDOW KEEPRATIO WND PROP OPENGL 3 opengl support Configuraci n Raspberry Pi 48 enum EVENT_MOUSEMOVE EVENT_LBUTTONDOWN EVENT_RBUTTONDOWN EVENT_MBUTTONDOWN EVENT_LBUTTONUP EVENT_RBUTTONUP EVENT_MBUTTONUP EVENT_LBUTTONDBLCLK EVENT_RBUTTONDBLCLK EVENT_MBUTTONDBLCLK EVENT_MOUSEWHEEL EVENT_MOUSEHWHEEL enum EVENT_FLAG_LBUTTON EVENT FLAG RBUTTON EVENT FLAG MBUTTON EVENT FLAG CTRLKEY EVENT FLAG SHIFTKEY EVENT FLAG ALTKEY Qt font enum QT FONT LIGHT QT FONT NORMAL QT FONT DEMIBOLD QT FONT BOLD QT FONT BLACK Qt font style enum QT STYLE NORMAL QT STYLE ITALIC QT STYLE OBLIQUE Qt button type enum QT_PUSH_BUTTON 0 QT_CHECKBOX 1 2 QT_RADIOBOX w v w amp P UNEO 25 50 63 75 8 QFont 1 QFont 2 QFont QFont QFont QFont QFont 87 QFont Light Normal DemiBold Bold Black StyleNormal StyleItalic Style0blique typedef void MouseCallback int event i
88. nt x int y int flags void userdata typedef void TrackbarCallback int pos voidt userdata typedef void OpenGlDrawCallback void userdata typedef void ButtonCallback int state void userdata CV EXPORTS W void namedWindow const String amp winname int flags WINDOW_AUTOSIZE Configuracion Raspberry Pi 49 CV_EXPORTS_W void destroyWindow const String amp winname CV_EXPORTS_W void destroyAllWindows CV_EXPORTS_W int startWindowThread CV_EXPORTS_W int waitKey int delay 0 CV_EXPORTS_W void imshow const String amp winname InputArray mat CV_EXPORTS_W void resizeWindow const String amp winname int width int height CV_EXPORTS_W void moveWindow const String amp winname int x int y CV_EXPORTS_W void setWindowProperty const String amp winname int prop_id double prop_value CV_EXPORTS_W double getWindowProperty const String amp winname int prop id assigns callback for mouse events CV_EXPORTS void setMouseCallback const String amp winname MouseCallback onMouse voidt userdata 8 CV_EXPORTS int getMouseWheelDelta int flags CV_EXPORTS int createTrackbar const String amp trackbarname const String amp winname int value int count TrackbarCallback onChange 8 void userdata 0 CV_EXPORTS_W int getTrackbarPos const String amp trackbarname const String amp winname CV_EXPORTS_W void setTrackbarPos const String amp trackbarname const String amp winname
89. nts InputOutputArray _image InputArray lines 8 Draw both vectors on the image canvas Uses blue for lines 1 and red for lines 2 param size The size of the image where lines were found param lines1 The first lines that need to be drawn Color Blue param lines2 The second lines that need to be drawn Color Red param image Optional image where lines will be drawn Should have the size of the image where the lines were found return The number of mismatching pixels between lines1 and lines2 ii CV WRAP virtual int compareSegments const Size amp size InputArray lines1 InputArray lines2 InputOutputArray image noArray 6 virtual LineSegmentDetector Returns a pointer to a LineSegmentDetector class CV_EXPORTS_W Ptr lt LineSegmentDetector gt createLineSegmentDetector int _refine LSD_REFINE_STD double _scale 0 8 double _sigma_scale 0 6 double _quant 2 8 double _ang th 22 5 double log eps 0 double density th 0 7 int n bins 1024 returns the Gaussian kernel with the specified parameters CV EXPORTS W Mat getGaussianKernel int ksize double sigma int ktype CV 64F initializes kernels of the generalized Sobel operator CV EXPORTS W void getDerivKernels OutputArray kx OutputArray ky int dx int dy int ksize bool normalize false int ktype CV 32F returns the Gabor kernel with the specified parameters CV_EXPOR
90. o de la conexi n 19 5 2 Conexi n remota a la Raspberry Pi usando SSH 20 5 2 1 Activaci n del servicio SSH en la Raspberry Pi 20 5 2 2 Instalaci n de Putty en Windows 20 5 3 Conexi n remota a la Raspberry Pi usando VNC 23 5 3 1 Instalaci n VNC en la Raspberry Pi 23 5 3 2 VNC por medio de aplicaciones 23 6 OpenCV en Raspberry 24 7 RaspiCamveriprogratias iia eene oe eoo unco rre n ER edis vv ep RE T vex s eR scissa Pepe Ru RT assasi 27 7 1 Paso 1 Compilaci n cda 27 7 2 Paso 2 Crear el primer proyecto 28 7 3 Paso 3 Mostrar na imagen 29 7 4 4 Proyectos VISI OM ss uu c ice e ita i o Eee Ee ERR D LEER ER 31 Configuraci n Raspberry Pi 1 8 1 Codigo PUSHES suse a cs 33 8 11 Rutina principal RE e R e ERE A 33 8 1 2 ClasePiCapturez eO Gas Ouen uides 35 8 2
91. odules python2 7 numpy core in lib python2 7 dist packages SPHINX BUILD NOTFOUND OFF OFF OFF OFF ON ON OFF ON ON 25 WITH_GTK ON WITH JASPER ON WITH JPEG ON WITH LIBVAL ON WITH NVCUVID OFF WITH OPENCL ON WITH OPENCLAMDBLAS ON WITH OPENCLAMDEFT ON WITH OPENEXR ON WITH OPENGL ON WITH OPENMP OFF WITH OPENNI OFF WITH PNG ON WITH PVAPI ON WITH QT OFF WITH TBB OFF WITH TIFF ON WITH UNICAP OFF WITH VAL ON WITH XIMEA OFF WITH XINE OFF Ilustraci n 29 Configuraci n ccmake e Tras configurar se compila con el comando make e Sino da fallo cosa que no suele ser habitual se instala con sudo make install Esta es la parte del proceso que lleva 10 horas suele tener un par de intervalos en los que parece que se ha quedado colgada en el 2896 y en el 3796 Con esto basta para realizar aplicaciones con im genes almacenadas pero si se quiere trabajar con las im genes de la RaspiCam ha de hacerse el siguiente paso Configuraci n Raspberry Pi 26 7 RaspiCam en programas Es el punto m s costoso de toda la instalaci n pues requiere vincular las librer as mmal con las librer as de OpenCV Para ello se han de seguir los siguientes pasos 7 1 Paso 1 Compilaci n 1 Descargar el c digo fuente como zip https github com raspberrypi userland 2 Descomprimir el archivo y copiarlo en el directorio opt vc Ju userland Ilustraci n 30 Directorio opt vc 3 Ejecutar
92. oint to fixed point format or backwards CV_EXPORTS_W void convertMaps InputArray map1 InputArray map2 OutputArray dstmap1 OutputArray dstmap2 int dstmapitype bool nninterpolation false returns 2x3 affine transformation matrix for the planar rotation CV_EXPORTS_W Mat getRotationMatrix2D Point2f center double angle double scale returns 3x3 perspective transformation for the corresponding 4 point pairs CV_EXPORTS Mat getPerspectiveTransform const Point2f src const Point2f dst returns 2x3 affine transformation for the corresponding 3 point pairs CV_EXPORTS Mat getAffineTransform const Point2f src const Point2f dst computes 2x3 affine transformation matrix that is inverse to the specified 2x3 affine transformation CV_EXPORTS_W void invertAffineTransform InputArray M OutputArray iM CV_EXPORTS_W Mat getPerspectiveTransform InputArray src InputArray dst CV_EXPORTS_W Mat getAffineTransform InputArray src InputArray dst extracts rectangle from the image at sub pixel location CV_EXPORTS_W void getRectSubPix InputArray image Size patchSize Point2f center OutputArray patch int patchType 1 computes the log polar transform CV_EXPORTS_W void logPolar InputArray src OutputArray dst Point2f center double M int flags computes the linear polar transform CV_EXPORTS_W void linearPolar InputArray src OutputArray dst Point2f center double maxRadi
93. ommand lin A5 SPI Enable Disable automatic loading A6 Audio Force audio out through HDMI or 3 A7 Update Update this tool to the latest ve lt Select gt Ilustraci n 14 Opciones avanzadas e Overscan corrige problemas con la salida de v deo e Hostname para ponerle un nombre de red as se identificar en la red local la nombramos raspberry e Memory Split para elegir el reparto de RAM entre la GPU tarjeta de v deo y el resto e SSH para activar o no el acceso remoto lo activamos e SPI activa e puerto SPI e Audio fuerza la salida de sonido e Update actualiza la herramienta Para terminar la primera configuraci n seleccionamos Finish la Raspberry Pi requiere reiniciarse para llevar a cabo la nueva configuraci n Configuraci n Raspberry Pi 14 5 Configuraci n para acceso remoto Este paso ha de llevarse a cabo sino disponemos de una pantalla con HDMI o RCA ya que una vez configurado se podr acceder a la Raspberry Pi desde el ordenador aunque nos deja sin la entrada de cable de red que ser necesaria para conectarse a esta El primer paso es comprobar la IP de la Raspberry Pi y si esta tiene acceso a internet ya que ser muy til para actualizar programas o realizar una simple conexi n a internet Tras conectar el cable de red si todo va bien han de estar encendidos los led 100 LNK y FDX p lt i llustraci n 15 LEDs conexi n red Configuraci n Raspberry Pi 15 5 1
94. opencv modules imgproc include opencv2 imgproc imgproc hpp gt include lt home pi opencv include opencv cv hpp gt Declaraciones using namespace cv using namespace std PiCapture cap int main int argc char argv Creaci n de variables bool isColor argc gt 2 namedWindow Circles cap open 640 480 isColor 2 true false Mat im binar im roi double time 8 unsigned int frames 0 int minRadius 10 int maxRadius 50 int GPIO 8 int Threshold 8 int Ox 150 0y 0 Width 340 Height 480 Para el ROI int Umbral 130 Configuraci n Raspberry Pi 33 Rect r_o_i Rect Ox Oy Width Height vector lt Vec3f gt circles Point center int radius Bucle continuo while char waitKey 1 q double tg getTickCount im cap grab frames if lim empty Binariza la imagen y creamos ROI threshold im binar Umbral 255 CV THRESH BINARY im roi binar r o i Busca c rculos HoughCircles im roi circles CV HOUGH GRADIENT 3 240 2 150 100 minRadius maxRadius if circles size 0 GPIO 8 else GPIO 1 center Point cvRound circles cvRound circles 1 radius cvRound circles 2 Si el circulo es correcto if minRadius lt radius amp amp radius lt maxRadius circle im_roi center radius CV_RGB 128 0 128 4 8 0 if GPIO 1 cout lt lt tSoldadura detectadain lt lt endl imshow Circles im roi
95. os 1 sudo apt get install ssh 1 sudo etc init d ssh start 1 sudo update rc d ssh defaults Ilustraci n 22 Servicio SSH RasPi 5 2 2 Instalaci n de Putty en Windows Ahora es necesario instalar el cliente SSH en Windows para esto es recomendable instalar el programa Putty el cual lo puede descargar aqu http www chiark greenend org uk sgtatham putty download html Es recomendable utilizar la versi n installer ya que este contiene todos los programas necesarios para hacer una conexi n remota con la Raspberry Pi y otros programas adicionales para incrementar el nivel de seguridad llustraci n 23 Putty Al ejecutar el programa nos aparecen todos los campos posibles para configurar distintas conexiones Configuraci n Raspberry Pi 20 Default Settings RaspbenyPi El Session Basic options for your PuTTY session Specify the destination you want to connect to Termini Keyboard Host Name or IP address Port i Features Connection type El Window O Raw Telnet Rlogin SSH Serial i Load save or delete a stored session i Behaviour Translation Saved Sessions i Colours El Connection dui Close window on exit Always Never 9 Only on clean exit Abot J Ce llustraci n 24 Par metros Putty Completaremos los par metros de acuerdo a la ilustraci n 19 y clicar el Save para guardar la configuraci
96. pse InputOutputArray img Point center Size axes double angle double startAngle double endAngle const Scalar amp color int thickness 1 int lineType LINE_8 int shift 0 draws a rotated ellipse in the image CV_EXPORTS_W void ellipse InputOutputArray img const RotatedRect amp box const Scalar amp color int thickness 1 int lineType LINE_8 draws a filled convex polygon in the image CV_EXPORTS void fillConvexPoly Mat amp img const Point pts int npts const Scalar amp color int lineType LINE_8 int shift 0 CV_EXPORTS_W void fillConvexPoly InputOutputArray img InputArray points const Scalar amp color int lineType LINE 8 int shift 0 fills an area bounded by one or more polygons CV EXPORTS void fillPoly Mat amp img const Point pts const int npts int ncontours const Scalar amp color int lineType LINE_8 int shift 0 Point offset Point CV_EXPORTS_W void fillPoly InputOutputArray img InputArrayOfArrays pts const Scalar amp color int lineType LINE_8 int shift 0 Point offset Point draws one or more polygonal curves CV_EXPORTS void polylines Mat amp img const Point const pts const int npts int ncontours bool isClosed const Scalar amp color Configuraci n Raspberry Pi 100 int thickness 1 int lineType LINE_8 int shift 0 CV_EXPORTS_W void polylines InputOutputArray img InputArrayOfArrays pts bool isClosed const
97. r as de OpenCV necesario incluirla en todos los proyectos que usen este conjunto de librer as C digo ifndef OPENCV OLD CV HPP tdefine _ OPENCV OLD CV HPP if defined GNUC warning This is a deprecated opencv header provided for compatibility Please include a header from a corresponding opencv module endif include cv h tinclude opencv2 core hpp include opencv2 imgproc hpp include opencv2 photo hpp include opencv2 video hpp include opencv2 highgui hpp include opencv2 features2d hpp include opencv2 calib3d hpp include opencv2 objdetect hpp Configuraci n Raspberry Pi 102
98. ray mean int flags int ctype CV_64F CV_EXPORTS_W void PCACompute InputArray data InputOutputArray mean OutputArray eigenvectors int maxComponents 0 CV_EXPORTS_W void PCACompute InputArray data InputOutputArray mean OutputArray eigenvectors double retainedVariance Configuraci n Raspberry Pi 60 CV_EXPORTS_W void PCAProject InputArray data InputArray mean InputArray eigenvectors OutputArray result CV EXPORTS W void PCABackProject InputArray data InputArray mean InputArray eigenvectors OutputArray result computes SVD of src CV EXPORTS W void SVDecomp InputArray src OutputArray w OutputArray u OutputArray vt int flags 0 performs back substitution for the previously computed SVD CV EXPORTS W void SVBackSubst InputArray w InputArray u InputArray vt InputArray rhs OutputArray dst computes Mahalanobis distance between two vectors sqrt v1 v2 icovar v1 v2 where icovar is the inverse covariation matrix CV_EXPORTS_W double Mahalanobis InputArray v1 InputArray v2 InputArray icovar performs forward or inverse 1D or 2D Discrete Fourier Transformation CV_EXPORTS_W void dft InputArray src OutputArray dst int flags 0 int nonzeroRows 0 performs inverse 1D or 2D Discrete Fourier Transformation CV_EXPORTS_W void idft InputArray src OutputArray dst int flags int nonzeroRows 0 performs forward or inverse 1D or 2D Discrete Cosine Transformation
99. ray src2 OutputArray dist int dtype OutputArray nidx int normType NORM_L2 int K 0 InputArray mask noArray int update 0 bool crosscheck false scales and shifts array elements so that either the specified norm alpha or the minimum alpha and maximum beta array values get the specified values CV_EXPORTS_W void normalize InputArray src InputOutputArray dst double alpha 1 double beta 0 int norm_type NORM L2 int dtype 1 InputArray mask noArray scales and shifts array elements so that either the specified norm alpha or the minimum alpha and maximum beta array values get the specified values CV_EXPORTS void normalize const SparseMat amp src SparseMat amp dst double alpha int normType finds global minimum and maximum array elements and returns their values and their locations CV_EXPORTS_W void minMaxLoc InputArray src CV_OUT double minVal CV OUT double maxVal 0 CV OUT Point minLoc CV_OUT Point maxLoc 0 InputArray mask noArray CV EXPORTS void minMaxIdx InputArray src double minVal double maxVal 0 int minIdx 0 int maxIdx 0 InputArray mask noArray finds global minimum and maximum sparse array elements and returns their values and their locations CV EXPORTS void minMaxLoc const SparseMat amp a double minVal double maxVal int minIdx 0 int maxIdx 0 transforms 2D matrix to 1D row or column vector by t
100. st UMat amp src2 UMat amp dst computes per element maximum of two arrays dst max srci src2 CV_EXPORTS void max const UMat amp srcl const UMat amp src2 UMat amp dst computes square root of each matrix element dst src 5 CV_EXPORTS_W void sqrt InputArray src OutputArray dst raises the input matrix elements to the specified power b a power CV_EXPORTS_W void pow InputArray src double power OutputArray dst computes exponent of each matrix element dst e src CV_EXPORTS_W void exp InputArray src OutputArray dst computes natural logarithm of absolute value of each matrix element dst log abs src CV_EXPORTS_W void log InputArray src OutputArray dst Configuraci n Raspberry Pi 58 converts polar coordinates to Cartesian CV_EXPORTS_W void polarToCart InputArray magnitude InputArray angle OutputArray x OutputArray y bool angleInDegrees false converts Cartesian coordinates to polar CV_EXPORTS_W void cartToPolar InputArray x InputArray y OutputArray magnitude OutputArray angle bool angleInDegrees false computes angle angle i of each x i y i vector CV_EXPORTS_W void phase InputArray x InputArray y OutputArray angle bool angleInDegrees false computes magnitude magnitude i of each x i y i vector CV_EXPORTS_W void magnitude InputArray x InputArray y OutputArray magnitude checks that each matrix element is within
101. t template lt typename _Tp int m int n int nm gt static void compute const Matx lt _Tp m n gt amp a Matx lt _Tp nm 1 gt amp w template typename Tp int m int n int nm int nb static void backSubst const Matx Tp nm 1 amp w const Matx Tp m nm amp u const Matx Tp n nm amp vt const Matx Tp m nb amp rhs Matx Tp n nb amp dst Mat u w vt Du Line iterator class The class is used to iterate over all the pixels on the raster line segment connecting two specified points f class CV EXPORTS Linelterator public intializes the iterator LineIterator const Mat amp img Point pt1 Point pt2 int connectivity 8 bool leftToRight false returns pointer to the current pixel uchart operator prefix increment operator it shifts iterator to the next pixel LineIterator amp operator postfix increment operator it shifts iterator to the next pixel Configuraci n Raspberry Pi 66 LineIterator operator int returns coordinates of the current pixel Point pos const uchart ptr const uchart ptro int step elemSize int err count int minusDelta plusDelta int minusStep plusStep el Random Number Generator The class implements RNG using Multiply with Carry algorithm f class CV_EXPORTS RNG t public enum UNIFORM NORMAL HU I e RNG RNG uint64 state updates the stat
102. t 1 return ret int PiCapture setBrightness int brightness int ret 0 if camera return 1 if brightness gt 0 amp amp brightness lt 100 MMAL RATIONAL value brightness 100 ret mmal status to int mmal port parameter set rational camera control MMAL PARAMETER BRIGHTNESS value else printf Invalid brightness value ret 1 return ret int PiCapture setISO int ISO if camera return 1 return mmal_status_to_int mmal_port_parameter_set_uint32 camera gt control MMAL_PARAMETER_ISO ISO int PiCapture setExposureMeteringMode MMAL PARAM EXPOSUREMETERINGMODE T m mode MMAL PARAMETER EXPOSUREMETERINGMODE T meter mode MMAL PARAMETER EXP METERING MODE sizeof meter_mode m mode if camera return 1 return mmal status to int mmal port parameter set camera control amp meter mode hdr int PiCapture setVideoStabilisation int vstabilisation if camera return 1 Configuraci n Raspberry Pi 43 return mmal_status_to_int mmal_port_parameter_set_boolean camera gt control MMAL_PARAMETER_VIDEO_STABILISATION vstabilisation int PiCapture setExposureCompensation int exp_comp if camera return 1 return mmal_status_to_int mmal_port_parameter_set_int32 camera gt control MMAL PARAMETER EXPOSURE COMP exp comp int PiCapture setExposureMode MMAL PARAM EXPOSUREMODE T mode MMAL PARAMETER EXPOS
103. t 0 rect h 0 if rect h gt 1 rect h 1 crop rect x 65536 rect x crop rect y 65536 rect y crop rect width 65536 rect w crop rect height 65536 rect h return mmal_port_parameter_set camera gt control amp crop hdr int PiCapture setShutterSpeed int speed if camera return 1 return mmal_status_to_int mmal_port_parameter_set_uint32 camera gt control MMAL_PARAMETER_SHUTTER_SPEED speed Configuraci n Raspberry Pi 46 8 2 C digo a compilar En Raspbian al igual que en Linux y usando el compilador GCC que trae por defecto instalado tanto la comprobaci n de errores como la compilaci n y la ejecuci n se hacen mediante ventana de comandos Para indicar los archivos que pertenecen a un proyecto y por lo tanto ha de compilar existen este tipo de archivos los CMakeLists en los que se indican los archivos a compilar cmake_minimum_required VERSION 2 8 project PiCapture SET COMPILE_DEFINITIONS Werror find_package OpenCV REQUIRED include_directories opt vc include include_directories opt vc include interface vcos pthreads include_directories opt vc include interface vmcs_host include_directories opt vc include interface vmcs_host linux include_directories USERLAND_DIR include_directories S PROJECT_SOURCE_DIR include link_directories opt vc lib link_directories opt vc src hello_pi libs vgfont add_executable main src main cpp src PiCapture cpp target link librar
104. ttp raufast org download camcv c 2 A adir estos include necesarios en la l nea 61 es una fuente frecuente de errores llustraci n 32 Rutas include 3 Modificar el tama o del archivo en la l nea 156 static int encoding xref size sizeof encoding xref sizeof encoding_xref 0 Assign a default set of parameters to the state passed in param state Pointer to state structure to assign defaults to static vold default status RASPISTILL STATE state t 1f state t vcos_assert 0 return PR modif for demo purpose smaller image state gt timeout 1000 5s delay before take image state width 320 2592 state sheight 200 1944 Ilustraci n 33 Tama o archivo 4 la funci n static void encoder buffer callback realizar los siguientes cambios oe PR OPEN CV Stuff here I create a CvMat empty structure with size of the buffer CvMat buf cvCreateMat 1 buffer gt Length CV_8UC1 copy buffer from cam to CvMat buf gt data ptr buffer gt data decode image interpret jpg IplImage img cvDecodeImage buf CV LOAD IMAGE COLOR we can save it f cvSavelmage foobar bmp 1mg 0 or display it cvNamedwindow camcvWin CV WINDOW AUTOSIZE cvShowImage camcvWin img cvWaitKey 0 Ilustraci n 34 static void encoder_buffer_callback Configuraci n Raspberry Pi 29 5 Enlasl neas 711 715 726 y 823 eli
105. tual int getCannyHighThresh const 8 Minimum distance between the centers of the detected objects virtual void setMinDist double minDist 0 virtual double getMinDist const 8 Inverse ratio of the accumulator resolution to the image resolution virtual void setDp double dp 8 virtual double getDp const 0 Maximal size of inner buffers virtual void setMaxBufferSize int maxBufferSize 0 virtual int getMaxBufferSize const 0 Ballard D H 1981 Generalizing the Hough transform to detect arbitrary shapes Pattern Recognition 13 2 111 122 Detects position only without traslation and rotation class CV_EXPORTS GeneralizedHoughBallard public GeneralizedHough i public R Table levels virtual void setLevels int levels 0 Configuraci n Raspberry Pi 83 virtual int getLevels const 0 The accumulator threshold for the template centers at the detection stage The smaller it is the more false positions may be detected virtual void setVotesThreshold int votesThreshold 8 virtual int getVotesThreshold const 0 Guil N Gonz lez Linares J M and Zapata E L 1999 Bidimensional shape detection using an invariant approach Pattern Recognition 32 6 1025 1038 Detects position traslation and rotation class CV EXPORTS GeneralizedHoughGuil public GeneralizedHough public Angle difference in degrees between two points in feature virtua
106. umulate false CV_EXPORTS_W void calcHist InputArrayOfArrays images const std vector lt int gt amp channels InputArray mask OutputArray hist const std vector lt int gt amp histSize const std vector lt float gt amp ranges bool accumulate false computes back projection for the set of images CV_EXPORTS void calcBackProject const Mat images int nimages const int channels InputArray hist OutputArray backProject const float ranges double scale 1 bool uniform true computes back projection for the set of images CV_EXPORTS void calcBackProject const Mat images int nimages const int channels const SparseMat amp hist OutputArray backProject const float ranges double scale 1 bool uniform true CV_EXPORTS_W void calcBackProject InputArrayOfArrays images const std vector lt int gt amp channels InputArray hist OutputArray dst const std vector lt float gt amp ranges double scale compares two histograms stored in dense arrays CV EXPORTS W double compareHist InputArray H1 InputArray H2 int method compares two histograms stored in sparse arrays CV EXPORTS double compareHist const SparseMat amp H1 const SparseMat amp H2 int method normalizes the grayscale image brightness and contrast by normalizing its histogram CV EXPORTS W void equalizeHist InputArray src OutputArray dst CV EXPORTS float EMD InputArray signaturel InputArray signat
107. urFX on or off int u v U and V to use MMAL PARAM COLOURFX T typedef struct double x double y double w double h PARAM FLOAT RECT T Configuraci n Raspberry Pi 35 brief setSaturation param saturation 100 100 return int setSaturation int saturation Jer brief setSharpness param sharpness 100 100 return 7 int setSharpness int sharpness brief setContrast param contrast 100 100 return E int setContrast int contrast per brief setBrightness param brightness 0 100 return aa int setBrightness int brightness JEF brief setISO param ISO 100 800 default is 300 return int setISO int ISO brief setExposureMeteringMode param m mode 0 4 return ui int setExposureMeteringMode MMAL PARAM EXPOSUREMETERINGMODE T m mode per brief setVideoStabilisation param vstabilisation 1 is on 0 is off return i int setVideoStabilisation int vstabilisation brief setExposureCompensation param exp comp 10 10 return int setExposureCompensation int exp comp per brief setExposureMode param mode 0 13 Configuraci n Raspberry Pi 36 return 8 int setExposureMode MMAL PARAM EXPOSUREMODE T mode per brief setAWBMode param amb mode 8 18 return int setAWBMode MMAL PARAM AWBMODE T amb mode brief setAWBGains param r gain 0 0 1 0 param b gain 0 0 1
108. ure2 int distType InputArray cost noArray float lowerBound 0 OutputArray flow noArray segments the image using watershed algorithm Configuraci n Raspberry Pi 95 CV_EXPORTS_W void watershed InputArray image InputOutputArray markers filters image using meanshift algorithm CV_EXPORTS_W void pyrMeanShiftFiltering InputArray src OutputArray dst double sp double sr int maxLevel 1 TermCriteria termcrit TermCriteria TermCriteria MAX_ITER TermCriteria EPS 5 1 segments the image using GrabCut algorithm CV_EXPORTS_W void grabCut InputArray img InputOutputArray mask Rect rect InputOutputArray bgdModel InputOutputArray fgdModel int iterCount int mode GC_EVAL builds the discrete Voronoi diagram CV_EXPORTS_AS distanceTransformWithLabels void distanceTransform InputArray src OutputArray dst OutputArray labels int distanceType int maskSize int labelType DIST_LABEL_CCOMP computes the distance transform map CV_EXPORTS_W void distanceTransform InputArray src OutputArray dst int distanceType int maskSize int dstType CV_32F fills the semi uniform image region starting from the specified seed point CV EXPORTS int floodFill InputOutputArray image Point seedPoint Scalar newVal CV OUT Rect rect e Scalar loDiff Scalar Scalar upDiff Scalar int flags 4 fills the semi uniform image region and or the mask starting from the specified se
109. us int flags computes the integral image Configuraci n Raspberry Pi 92 CV_EXPORTS_W void integral InputArray src OutputArray sum int sdepth 1 computes the integral image and integral for the squared image CV EXPORTS AS integral2 void integral InputArray src OutputArray sum OutputArray sqsum int sdepth 1 int sqdepth 1 computes the integral image integral for the squared image and the tilted integral image CV EXPORTS AS integral3 void integral InputArray src OutputArray sum OutputArray sqsum OutputArray tilted int sdepth 1 int sqdepth 1 adds image to the accumulator dst src Unlike cv add dst and src can have different types CV_EXPORTS_W void accumulate InputArray src InputOutputArray dst InputArray mask noArray adds squared src image to the accumulator dst src src CV_EXPORTS_W void accumulateSquare InputArray src InputOutputArray dst InputArray mask noArray adds product of the 2 images to the accumulator dst srcl src2 CV_EXPORTS_W void accumulateProduct InputArray srcl InputArray src2 InputOutputArray dst InputArray mask noArray updates the running average dst dst 1 alpha src alpha CV_EXPORTS_W void accumulateWeighted InputArray src InputOutputArray dst double alpha InputArray mask noArray CV_EXPORTS_W Point2d phaseCorrelate InputArray srcl InputArray src2 InputArray window no
110. ut image param _image A grayscale CV_8UC1 input image If only roi needs to be selected use T lsd ptr detect image roi lines lines Scalar roi x roi y roi x roi y param _lines Return A vector of Vec4i elements specifying the beginning and ending point of a line Where Vec4i is x1 yl X2 y2 point 1 is the start point 2 end Returned lines are strictly oriented depending the gradient param width Return Vector of widths of the regions where the lines are found E g Width of line param prec Return Vector of precisions with which the lines are found param nfa Return Vector containing number of false alarms in the line region with precision of 10 T The bigger the value logarithmically better the detection 1 corresponds to 10 mean false alarms m corresponds to 1 mean false alarm 1 corresponds to 0 1 mean false alarms This vector will be calculated _only_ when the objects type is REFINE_ADV CV_WRAP virtual void detect InputArray _image OutputArray _lines OutputArray width noArray OutputArray prec noArray OutputArray nfa noArray 0 Jer Draw lines on the given canvas param image The image where lines will be drawn Should have the size of the image where the lines found param lines The lines that need to be drawn Configuraci n Raspberry Pi 87 CV_WRAP virtual void drawSegme
Download Pdf Manuals
Related Search
Related Contents
Bedienungsanleitung DUAL 4.0 Installation and Care Guide Baixar o Arquivo - Módulo de Consulta dos Magistrados 平成25年度指定管理者モニタリング結果(その2)(PDF MINI-CAN User Manual Issue – 1.01 SMART Table 442i Centro de aprendizado colaborativo Guia do PSL 濁度標準液は 100 度標準液 PORTADA DA-120D4.cdr Copyright © All rights reserved.
Failed to retrieve file