<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">El 12/03/14 20:31, Edgar Barrero Mateo
escribió:<br>
</div>
<blockquote cite="mid:BLU0-SMTP311DD33CB18C11A8D36AF619E760@phx.gbl"
type="cite">
<pre wrap="">Quizá es una duda tonta la que planteo pero bueno. ¿que devuelve en cada
petición Ice cameraview? Es un array de pixeles RGB?¿que formato
exactamente tiene esa imagen?</pre>
</blockquote>
<br>
<br>
Todo depende del componente que envíe la imagen. En mi caso yo envío
desde Android imágenes en formato NV21.<br>
<br>
<br>
<br>
<blockquote cite="mid:BLU0-SMTP311DD33CB18C11A8D36AF619E760@phx.gbl"
type="cite">
<pre wrap="">¿Otra pregunta en el mismo sentido es qué devuelve exactamente
pclRGBDServer?</pre>
</blockquote>
<br>
<br>
A esto no te voy a responder, pero te animo que consultes el código
de la interfaz:<br>
<a class="moz-txt-link-freetext" href="http://svn.jderobot.org/jderobot/trunk/src/stable/interfaces/slice/jderobot/">http://svn.jderobot.org/jderobot/trunk/src/stable/interfaces/slice/jderobot/</a><br>
<br>
<br>
<br>
<blockquote cite="mid:BLU0-SMTP311DD33CB18C11A8D36AF619E760@phx.gbl"
type="cite">
<pre wrap="">Y por último y para no tener que volver a hacer preguntas tan simples,
¿Hay algún sitio donde encontrar algun manual o explicación de cada
componente?</pre>
</blockquote>
<br>
<br>
Lo mejor es consultar directamente el código. Comprobarás que están
muy documentados y casi todo el código es autoexplicativo.<br>
<br>
Ejemplo:<br>
<a class="moz-txt-link-freetext" href="http://svn.jderobot.org/jderobot/trunk/src/stable/interfaces/slice/jderobot/image.ice">http://svn.jderobot.org/jderobot/trunk/src/stable/interfaces/slice/jderobot/image.ice</a><br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;"> /**
* A single image served as a sequence of bytes
*/
class ImageData
{
Time timeStamp; /**< TimeStamp of Data */
ImageDescription description; /**< ImageDescription of Data, for convienence purposes */
ByteSeq pixelData; /**< The image data itself. The structure of this byte sequence
                         depends on the image format and compression. */
};
</pre>
<br class="Apple-interchange-newline">
Tal y como puedes ver la imagen en sí es una secuencia de bytes sin
ningún formato en particular. El formato en el que se envía esa
secuencia de bytes está definido en:<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;"> /**
* Static description of the image source.
*/
class ImageDescription
{
int width; /**< %Image width [pixels] */
int height;/**< %Image height [pixels] */
int size;/**< %Image size [bytes] */
string format; /**< %Image format string */
};</pre>
<br>
Es decir, en la descripción de la imagen (y no en los datos de la
imagen) se indica en qué formato están los datos.<br>
<br>
Yo implementé en colorspaces un conversor de NV21 (el formato nativo
de Android) a RGB:<br>
<a class="moz-txt-link-freetext" href="http://svn.jderobot.org/jderobot/tags/Jderobot-5.2.0/src/libs/colorspaces/imagecv.cpp">http://svn.jderobot.org/jderobot/tags/Jderobot-5.2.0/src/libs/colorspaces/imagecv.cpp</a><br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;">const Image::FormatPtr ImageNV21::FORMAT_NV21 = Image::Format::createFormat("NV21",CV_8UC2,&ImageNV21::createInstance,&ImageNV21::imageCvt);
</pre>
<br class="Apple-interchange-newline">
<br>
Ahora se usan otros métodos para convertir esa secuencia de bytes
(sea cual sea el formato) a RGB (8 bits por canal y 3 canales). Si
miras el código de introrob:<br>
<a class="moz-txt-link-freetext" href="http://svn.jderobot.org/jderobot/trunk/src/stable/components/introrob/control.cpp">http://svn.jderobot.org/jderobot/trunk/src/stable/components/introrob/control.cpp</a><br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;"> void Control::createImage(Api *api) {
cvReleaseImage(&image);
this->image = cvCreateImage(cvSize(api->imageData1->description->width, api->imageData1->description->height), 8, 3);
memcpy((unsigned char *) image->imageData, &(api->imageData1->pixelData[0]), image->width * image->height * 3);
/*
colorspaces::Image::FormatPtr fmt = colorspaces::Image::Format::searchFormat(api->imageData1->description->format);
if (!fmt)
throw "Format not supported";
*/
api->imgBuff =
Gdk::Pixbuf::create_from_data((const guint8*) this->image->imageData,
Gdk::COLORSPACE_RGB,
false,
this->image->depth,
this->image->width,
this->image->height,
this->image->widthStep);
}
</pre>
<br class="Apple-interchange-newline">
Si usas introrob como base obtendrás la imagen en formato RGB
preparada para ser analizada. Mira este ejemplo:<br>
<a class="moz-txt-link-freetext" href="http://svn.jderobot.org/jderobot/trunk/src/stable/components/introrob/MyAlgorithms.cpp">http://svn.jderobot.org/jderobot/trunk/src/stable/components/introrob/MyAlgorithms.cpp</a><br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; white-space: pre-wrap;"> imageCameras2openCV(); //Esta función es necesario llamarla ANTES de trabajar con las imágenes de las cámaras.
IplImage src = *this->imageCameraLeft; //Imagen de la cámara izquierda
for (i = 0; i < src.width; i++) {
for (j = 0; j < src.height; j++) {
if (((int) (unsigned char) src.imageData[(j * src.width + i) * src.nChannels] > 120) &&
((int) (unsigned char) src.imageData[(j * src.width + i) * src.nChannels + 1] < 70) &&
((int) (unsigned char) src.imageData[(j * src.width + i) * src.nChannels + 2] < 70)) {
cont++;
src.imageData[(j * src.width + i) * src.nChannels] = 255; //R
src.imageData[(j * src.width + i) * src.nChannels + 1] = 255; //G
src.imageData[(j * src.width + i) * src.nChannels + 2] = 0; //B
}
}
}
</pre>
<br class="Apple-interchange-newline">
<br>
Espero que te haya servido de guía (más que ayuda).<br>
<br>
Un saludo.<br>
</body>
</html>