<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Instalando y compilando Opencv 3.1 con VS2015 - Lenguaje C/C++				            </title>
            <link>https://www.arde.cc/foro/lenguaje-c-c/instalando-y-compilando-opencv-3-1-con-vs2015/</link>
            <description>Asociación de Robótica y Domótica de España</description>
            <language>es</language>
            <lastBuildDate>Thu, 12 Mar 2026 17:04:43 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>Re: Instalando y compilando Opencv 3.1 con VS2015</title>
                        <link>https://www.arde.cc/foro/lenguaje-c-c/instalando-y-compilando-opencv-3-1-con-vs2015/#post-42783</link>
                        <pubDate>Wed, 24 Aug 2016 11:48:53 +0000</pubDate>
                        <description><![CDATA[Aprovecho para poner muy resumido como se instala opencv2.4.xx, pues me parece que es algo mas ligero:1. Bajarse Opencv 2.4.13 de sourceforge y descomprimir2. Creo c:OpenCV2.4 y pego desde e...]]></description>
                        <content:encoded><![CDATA[Aprovecho para poner muy resumido como se instala opencv2.4.xx, pues me parece que es algo mas ligero:<br><br>1. Bajarse Opencv 2.4.13 de sourceforge y descomprimir<br>2. Creo c:OpenCV2.4 y pego desde el downloadsopencvbuildinclude al c:OpenCV2.4include todo el contenido (si no saldrán errores de que no se encuentra el highgui.hpp o el core_c.h)<br>3. Idem con directorio downloadsopencvbuildx64 al c:OpenCV2.4x64<br>4. Añadir a variable de entorno PATH C:opencv2.4x64vc12bin   (rearrancar el VS)<br><br>5. En el visual studio 2013 Crear proyecto vacio. Abrir Proyecto (all configurations y x64) &gt; properties &gt; y añadir:<br>C/C++ &gt; general &gt; Additional Include directories: c:OpenCV2.4includeopencv2;c:OpenCV2.4includeopencv;c:OpenCV2.4include<br>Linker &gt; General &gt; Additional Library Directories: c:OpenCV2.4x64vc12lib  (ó c:OpenCV2.4Win32vc12lib si el proyecto fuera Win32)<br>Linker &gt; Input &gt; Additional dependencies:   opencv_core2413.lib   opencv_highgui2413.lib   ó     opencv_core2413d.lib   opencv_highgui2413d.lib<br><br>Añadir al c++ los headers: <br><br>#include &lt;opencv.hpp&gt; <br>#include &lt;highgui.hpp&gt;]]></content:encoded>
						                            <category domain="https://www.arde.cc/foro/lenguaje-c-c/">Lenguaje C/C++</category>                        <dc:creator>fusion</dc:creator>
                        <guid isPermaLink="true">https://www.arde.cc/foro/lenguaje-c-c/instalando-y-compilando-opencv-3-1-con-vs2015/#post-42783</guid>
                    </item>
				                    <item>
                        <title>Instalando y compilando Opencv 3.1 con VS2015</title>
                        <link>https://www.arde.cc/foro/lenguaje-c-c/instalando-y-compilando-opencv-3-1-con-vs2015/#post-4309</link>
                        <pubDate>Mon, 09 May 2016 14:45:30 +0000</pubDate>
                        <description><![CDATA[Me ha costado lo suyo, y lo he hecho de la iguiente forma:Me he bajado la version windows que es la que uso, he abierto el proyecto y he compilado en modo x64 tanto en modos Debug y Release ...]]></description>
                        <content:encoded><![CDATA[Me ha costado lo suyo, y lo he hecho de la iguiente forma:<br><br>Me he bajado la version windows que es la que uso, he abierto el proyecto y he compilado en modo x64 tanto en modos Debug y Release saliendo todo ok, entonces he copiado el directorio del proyecto "include" (el que incluye D:OpenCV31includeopencv2imgproc, etc...) en d:openVC31include<br>Despues todos los .lib tanto los del modo release como los de modo debug en D:OpenCV31lib<br>Despues todas las dlls tanto las de modo debug como release en  D:OpenCV31bin<br><br>Entonces abro el proyecto para ver las propiedades y he hecho:<br><br>En todas las configuraciones (debug y release):<br>  Proyecto &gt; properties &gt; C/C++ &gt; general &gt; Additional Include directories: D:OpenCV31include<br>  Linker &gt; General &gt; Additional Library Directories: D:OpenCV31lib<br>  Linker &gt; Input &gt; Additional dependencies:   <br>  <br>  Modo release:<br>opencv_core310.lib                      <br>opencv_highgui310.lib<br>opencv_imgproc310.lib<br>opencv_imgcodecs310.lib<br><br>Modo debug:<br><br>opencv_core310d.lib<br>opencv_highgui310d.lib<br>opencv_imgproc310d.lib<br>opencv_imgcodecs310d.lib<br><br>Luego a la "Environment variable" path he añadido D:OpenCV31.lib<br><br>OJO!! hay que incluir imgcodecs.hpp pues en caso contrario no puedes leer ficheros de imagenes pues la funcion imread ha sido movida a imgcodecs.hpp desde la version 2.4.<br><br>Ejemplo:
<CODE>#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"

#include &lt;iostream&gt;
#include &lt;string&gt;

typedef unsigned char uchar;
using namespace cv;
using namespace std;



#define NCALLE 8
char calles={
	"amsterdam.jpg",
	"madrid.jpg",
	"madrid1.jpg",
	"JesusM1.jpg",
	"JesusM2.jpg",
	"Mexico.jpg",
	"Ferraz.jpg",
	"Mayor.jpg"};

//Ver hoja excel: "Exposure saturation.xlsx". Ideal contrast=saturation=1.45 o mejor 1.50
//exposure y brightness=0.0 no afectan
void applyLevels(Mat imagen, double exposure, double brightness, double contrast, double saturation);
void applyLevels(Mat imagen1,Mat imagen2, double exposure, double brightness, double contrast, double saturation); 


int main(int, char**)
{
	printf("Inicion");
    namedWindow("Ventana", 1);
	
	/// Matrices to store images
	Mat frame1,frame2,frame3,frame4; 

	char fichero1;
	strcpy(fichero1,"data/");strcat(fichero1,"72.jpg");
	string fichero(fichero1);

	//frame1=cvLoadImageM(fichero, CV_LOAD_IMAGE_COLOR );
	frame1 = imread(fichero, IMREAD_COLOR);  //cvLoadImageM(fichero, CV_LOAD_IMAGE_COLOR);

	if( !frame1.data ) { printf("Error loading src1 n"); getchar();getchar();return -1; }
	long w2=800,h2=w2*frame1.rows/frame1.cols;//800 pixels de ancho
	resize(frame1, frame2, Size(w2, h2), 0, 0, INTER_CUBIC);
	frame3=frame2.clone();//para cojer el mismo tamaño
	frame4=frame2.clone();

	double exposure=0.0,brightness=0.0,contrast=1.0,saturation=1.0;
	int i_expos,i_brigh,i_contr,i_satur;
	i_expos=0;i_brigh=0;i_contr=50;i_satur=50;
    createTrackbar("Exposure", "Ventana", &amp;i_expos, 200);
    createTrackbar("Brigness", "Ventana", &amp;i_brigh, 200);
    createTrackbar("Contrast", "Ventana", &amp;i_contr, 100);
    createTrackbar("Saturate", "Ventana", &amp;i_satur, 200);

	while(true)
	{
		exposure  =0.02*i_expos;
		brightness=0.02*i_brigh;
		contrast  =i_contr/50.0;
		saturation=i_satur/50.0;
		applyLevels(frame2,frame3,exposure,brightness,contrast,saturation);	
		//frame3=frame2.clone();
		//applyLevels(frame3,exposure,brightness,contrast,saturation);	
           //show the brightness and contrast adjusted image
        imshow("Ventana", frame3);

        // Wait until user press some key for 50ms
        int iKey = waitKey(50);
        //if user press 'ESC' key
        if (iKey == 27)
        {
			break;
        }
     }
	printf("nFINn exposure=%lg tbrightness=%lg tcontrast=%lg tsaturation=%lg",exposure,brightness,contrast,saturation);
	getchar();getchar();

	return 0;
}

//Ver hoja excel: "Exposure saturation.xlsx"
//Se recomienda contraste=saturacion=1.45 
void applyLevels(Mat imagen, double exposure, double brightness, double contrast, double saturation)
{
	uchar *rgb=imagen.data;
	long  step=imagen.step;
	long height=imagen.rows;
    double exposureFactor   = pow(2.0, exposure);
    double brightnessFactor = brightness / 10.0;
    double contrastFactor   = contrast &gt; 0.0 ? contrast : 0.0;
    double saturationFactor = 1.0f - saturation;

    double f01 = exposureFactor / 255.0 * contrastFactor;
    double f02 = 0.5f * (1.0f - contrastFactor);

    long nPixel = step * height;
    for(long pixelIndex = 0; pixelIndex &lt; nPixel; pixelIndex+=3)
    {
        double R = rgb;
        double G = rgb;
        double B = rgb;

        R = R * f01 + f02;
        G = G * f01 + f02;
        B = B * f01 + f02;

        double f03 = ((R * 0.3) + (G * 0.59) + (B * 0.11)) * saturationFactor + brightnessFactor;

        R = (R * saturation + f03) * 255.0;
        G = (G * saturation + f03) * 255.0;
        B = (B * saturation + f03) * 255.0;

        R = R &gt; 255.0 ? 255.0 : R &lt; 0.0 ? 0.0 : R;
        G = G &gt; 255.0 ? 255.0 : G &lt; 0.0 ? 0.0 : G;
        B = B &gt; 255.0 ? 255.0 : B &lt; 0.0 ? 0.0 : B;

		rgb=(uchar) R;
		rgb=(uchar) G;
		rgb=(uchar) B;
    }
}


void applyLevels(Mat imagen1,Mat imagen2, double exposure, double brightness, double contrast, double saturation)
{
	uchar *rgb1=imagen1.data;
	uchar *rgb2=imagen2.data;
	long  step=imagen1.step;
	long height=imagen1.rows;
	if ( (height!=imagen2.rows) || (step!=imagen2.step) )
	{
		printf("nError en applyLevels() imagen1 size != imagen2 size");getchar();getchar();return;
	}
    double exposureFactor   = pow(2.0, exposure);
    double brightnessFactor = brightness / 10.0;
    double contrastFactor   = contrast &gt; 0.0 ? contrast : 0.0;
    double saturationFactor = 1.0f - saturation;

    double f01 = exposureFactor / 255.0 * contrastFactor;
    double f02 = 0.5f * (1.0f - contrastFactor);

    long nPixel = step * height;
    for(long pixelIndex = 0; pixelIndex &lt; nPixel; pixelIndex+=3)
    {
        double R = rgb1;
        double G = rgb1;
        double B = rgb1;

        R = R * f01 + f02;
        G = G * f01 + f02;
        B = B * f01 + f02;

        double f03 = ((R * 0.3) + (G * 0.59) + (B * 0.11)) * saturationFactor + brightnessFactor;

        R = (R * saturation + f03) * 255.0;
        G = (G * saturation + f03) * 255.0;
        B = (B * saturation + f03) * 255.0;

        R = R &gt; 255.0 ? 255.0 : R &lt; 0.0 ? 0.0 : R;
        G = G &gt; 255.0 ? 255.0 : G &lt; 0.0 ? 0.0 : G;
        B = B &gt; 255.0 ? 255.0 : B &lt; 0.0 ? 0.0 : B;

		rgb2=(uchar) R;
		rgb2=(uchar) G;
		rgb2=(uchar) B;
    }
}</CODE>]]></content:encoded>
						                            <category domain="https://www.arde.cc/foro/lenguaje-c-c/">Lenguaje C/C++</category>                        <dc:creator>fusion</dc:creator>
                        <guid isPermaLink="true">https://www.arde.cc/foro/lenguaje-c-c/instalando-y-compilando-opencv-3-1-con-vs2015/#post-4309</guid>
                    </item>
							        </channel>
        </rss>
		