[Jderobot-admin] jderobot-r1083 - trunk/src/stable/components/colorTuner
bmenendez en jderobot.org
bmenendez en jderobot.org
Mie Oct 30 18:22:13 CET 2013
Author: bmenendez
Date: 2013-10-30 18:22:13 +0100 (Wed, 30 Oct 2013)
New Revision: 1083
Modified:
trunk/src/stable/components/colorTuner/viewer.cpp
trunk/src/stable/components/colorTuner/viewer.h
Log:
Modificado el viewer para que cuando se haga clic en la imagen original y se
obtengan los valores R, G, B y H, S, V se guarden autom?\195?\161ticamente en un
fichero de texto. Esto facilita la tarea para quien est?\195?\169 haciendo un filtro
basado en estos modelos de color, que podr?\195?\161n cambiar su filtro en caliente si,
por ejemplo, cada 10 segundos leen los valores del fichero de texto.
Modified: trunk/src/stable/components/colorTuner/viewer.cpp
===================================================================
--- trunk/src/stable/components/colorTuner/viewer.cpp 2013-10-30 11:28:01 UTC (rev 1082)
+++ trunk/src/stable/components/colorTuner/viewer.cpp 2013-10-30 17:22:13 UTC (rev 1083)
@@ -1001,10 +1001,22 @@
g = (float)(unsigned int) (unsigned char)imageDemo->imageData[indice+1];
b = (float)(unsigned int) (unsigned char)imageDemo->imageData[indice+2];
+ std::fstream fs;
+ fs.open("filterRGB.txt", std::fstream::out);
+ if (fs.is_open()) {
+ fs << r << "\r\n" << g << "\r\n" << b << std::endl;
+ fs.close();
+ }
h = getH(r, g, b);
s = getS(r, g, b);
v = getV(r, g, b);
+
+ fs.open("filterHSV.txt", std::fstream::out);
+ if (fs.is_open()) {
+ fs << h << "\r\n" << s << "\r\n" << v << std::endl;
+ fs.close();
+ }
pthread_mutex_unlock(&mutex);
Modified: trunk/src/stable/components/colorTuner/viewer.h
===================================================================
--- trunk/src/stable/components/colorTuner/viewer.h 2013-10-30 11:28:01 UTC (rev 1082)
+++ trunk/src/stable/components/colorTuner/viewer.h 2013-10-30 17:22:13 UTC (rev 1083)
@@ -29,6 +29,8 @@
#include <string>
#include <visionlib/colorspaces/colorspacesmm.h>
#include <highgui.h>
+#include <sstream>
+#include <fstream>
#define PI 3.141592654
#define SQUARE(a) (a)*(a)
More information about the Jderobot-admin
mailing list