#-------------------------------------------------
#
# Project created by QtCreator 2013-07-02T14:44:42
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = sincmake
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:opencvbuildinclude
LIBS +=-LC:opencvbuildx86mingwlib
-lopencv_core245
-lopencv_highgui245
-lopencv_imgproc245
-lopencv_video245
////////////////////////// main.cpp////////////////////////////
#include <QCoreApplication>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main()
{
//QCoreApplication a(argc, argv);
/*
IplImage *image = cvLoadImage("C:celular.jpg");
Mat im(image);
imshow("TEST",im);
waitKey();
*/
IplImage *image = cvLoadImage("C:lena.jpg",1);
cvShowImage("TEST",image);
cvWaitKey();
cout<<"Hola mundo cruel ... "<<endl;
return 0;
}
/////////////////////////////////////
#include <QCoreApplication>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
using namespace std;
using namespace cv;
int main()
{
cout<<"Hola Mundo Cruel .."<<endl;
IplImage* src; // imagen de color base
IplImage* colorThresh; // contendrá la imagen de color binarizada
IplImage* gray; // contendrá la imagen convertida en escala de grises
IplImage* grayThresh; // imagen binaria conseguida a partir de la imagen en
escala de grises
int threshold = 120; // definimos el valor umbral
int maxValue = 255; // definimos el valor máximo
int thresholdType = CV_THRESH_BINARY; // definimos el tipo de binarización
src = cvLoadImage("C:lena.jpg"); // cargamos imagen de color
colorThresh = cvCloneImage( src ); // copiamos esa imagen de color
gray=cvCreateImage( cvSize(src->width, src->height), IPL_DEPTH_8U, 1 );
// la imagen de intensidad tendrá la misma configuración
// que la fuente pero con un solo canal
cvCvtColor( src, gray, CV_BGR2GRAY ); // pasamos la imagen de color a escala
de grises
grayThresh = cvCloneImage( gray ); // copiamos la imagen en escala
// de grises (truco anterior)
cvNamedWindow( "src", 1 ); // representamos la imagen de color
cvShowImage( "src", src );
cvNamedWindow( "gray", 1 ); // representamos la imagen de intensidad
cvShowImage( "gray", gray );
cvThreshold(src, colorThresh, threshold, maxValue, thresholdType);
// binarizamos la imagen de color
cvThreshold(gray, grayThresh, threshold, maxValue, thresholdType);
// binarizamos la imagen de intensidad
cvNamedWindow( "colorThresh", 1 ); // representamos la imagen
// de color binarizada
cvShowImage( "colorThresh", colorThresh );
cvNamedWindow( "grayThresh", 1 ); // representamosla imagen
// de intensidad binarizada
cvSaveImage("lena1.bmp", gray); // guardamos la imagen
cvSaveImage("lena2.bmp", grayThresh); // guardamos la imagen
cvShowImage( "grayThresh", grayThresh );
cvWaitKey(0); // pulsamos tecla para terminar
cvDestroyWindow( "src" ); // destruimos todas las ventanas
cvDestroyWindow( "colorThresh" );
cvDestroyWindow( "gray" );
cvDestroyWindow( "grayThresh" );
cvReleaseImage( &src ); // eliminamos todas las imágenes
cvReleaseImage( &colorThresh );
cvReleaseImage( &gray );
cvReleaseImage( &grayThresh );
//getch (1);
cout<<"Adios Mundo Cruel .."<<endl;
return 0;
}
////////////////////////////////////////////
Modulo de Tratamiento de imagenes.
___________________________________________
Binarizacion ---> ok.
Filtracion. --->
Segmentacion. --->
Escalamiento. --->
Extraccion. --->

Archivo pro

  • 1.
    #------------------------------------------------- # # Project createdby QtCreator 2013-07-02T14:44:42 # #------------------------------------------------- QT += core QT -= gui TARGET = sincmake CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp INCLUDEPATH += C:opencvbuildinclude LIBS +=-LC:opencvbuildx86mingwlib -lopencv_core245 -lopencv_highgui245 -lopencv_imgproc245 -lopencv_video245 ////////////////////////// main.cpp//////////////////////////// #include <QCoreApplication> #include <iostream> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace std; using namespace cv; int main() { //QCoreApplication a(argc, argv); /* IplImage *image = cvLoadImage("C:celular.jpg"); Mat im(image); imshow("TEST",im); waitKey(); */ IplImage *image = cvLoadImage("C:lena.jpg",1); cvShowImage("TEST",image); cvWaitKey(); cout<<"Hola mundo cruel ... "<<endl; return 0; }
  • 2.
    ///////////////////////////////////// #include <QCoreApplication> #include <iostream> #include<opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv/cv.h> using namespace std; using namespace cv; int main() { cout<<"Hola Mundo Cruel .."<<endl; IplImage* src; // imagen de color base IplImage* colorThresh; // contendrá la imagen de color binarizada IplImage* gray; // contendrá la imagen convertida en escala de grises IplImage* grayThresh; // imagen binaria conseguida a partir de la imagen en escala de grises int threshold = 120; // definimos el valor umbral int maxValue = 255; // definimos el valor máximo int thresholdType = CV_THRESH_BINARY; // definimos el tipo de binarización src = cvLoadImage("C:lena.jpg"); // cargamos imagen de color colorThresh = cvCloneImage( src ); // copiamos esa imagen de color gray=cvCreateImage( cvSize(src->width, src->height), IPL_DEPTH_8U, 1 ); // la imagen de intensidad tendrá la misma configuración // que la fuente pero con un solo canal cvCvtColor( src, gray, CV_BGR2GRAY ); // pasamos la imagen de color a escala de grises grayThresh = cvCloneImage( gray ); // copiamos la imagen en escala // de grises (truco anterior) cvNamedWindow( "src", 1 ); // representamos la imagen de color cvShowImage( "src", src ); cvNamedWindow( "gray", 1 ); // representamos la imagen de intensidad cvShowImage( "gray", gray ); cvThreshold(src, colorThresh, threshold, maxValue, thresholdType); // binarizamos la imagen de color cvThreshold(gray, grayThresh, threshold, maxValue, thresholdType); // binarizamos la imagen de intensidad cvNamedWindow( "colorThresh", 1 ); // representamos la imagen // de color binarizada cvShowImage( "colorThresh", colorThresh ); cvNamedWindow( "grayThresh", 1 ); // representamosla imagen // de intensidad binarizada cvSaveImage("lena1.bmp", gray); // guardamos la imagen cvSaveImage("lena2.bmp", grayThresh); // guardamos la imagen cvShowImage( "grayThresh", grayThresh ); cvWaitKey(0); // pulsamos tecla para terminar cvDestroyWindow( "src" ); // destruimos todas las ventanas cvDestroyWindow( "colorThresh" ); cvDestroyWindow( "gray" ); cvDestroyWindow( "grayThresh" ); cvReleaseImage( &src ); // eliminamos todas las imágenes cvReleaseImage( &colorThresh ); cvReleaseImage( &gray ); cvReleaseImage( &grayThresh ); //getch (1); cout<<"Adios Mundo Cruel .."<<endl; return 0; } ////////////////////////////////////////////
  • 3.
    Modulo de Tratamientode imagenes. ___________________________________________ Binarizacion ---> ok. Filtracion. ---> Segmentacion. ---> Escalamiento. ---> Extraccion. --->