Hola Eloy,<div><br></div><div>te comento, en el código hay una variable que se llama <b>imfBuff</b> (Buffer que contiene la imagen que quieres mostrar por pantalla)<b> y gtkimage</b> ( que es de tipo Gtk::Image* y es el widget que contiene la imagen de la interfaz gráfica) . Tienes que modificarlo para que muestre la que tu quieras. Por ejemplo si quieres mostrar en la GUI la imagen en escala de grises greyMat</div>
<div><br></div><div><div>Glib::RefPtr<Gdk::Pixbuf> imgBuff = Gdk::Pixbuf::create_from_data((const guint8*) <b><span style="font-family:'courier new',monospace">greyMat</span>.data</b>,</div><div> Gdk::COLORSPACE_RGB,</div>
<div> false,</div><div> 8,</div><div> <b> <span style="font-family:'courier new',monospace">greyMat.cols</span></b>,</div>
<div> <b> <span style="font-family:'courier new',monospace">greyMat.rows</span></b>,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span> <b><span style="font-family:'courier new',monospace">greyMat</span>.step</b>);</div>
</div><div><br></div><div>gtkimage->set(imgBuff);</div><div><br></div><div>Saludos</div><div><br></div><div>Álex.</div><div><br></div><div><div class="gmail_quote">El 15 de febrero de 2013 13:45, Eloy <span dir="ltr"><<a href="mailto:abanibiaboebe@gmail.com" target="_blank">abanibiaboebe@gmail.com</a>></span> escribió:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hola, tengo una duda acerca de como mostrar una imagen tratada, en el gui de basic_component.<br><br>En el hilo de control tengo lo siguiente:<br>
<b><span style="font-family:courier new,monospace"><br></span></b><span style="font-family:courier new,monospace"> void Control::UpdateSensorsICE(Api *api) {<br>
<br> pthread_mutex_lock(&api->controlGui);<br><br><b> //Obtengo la imagen de la camara</b><br> jderobot::ImageDataPtr imageFromIce = this->cprx1->getImageData();<br> colorspaces::Image::FormatPtr fmt = colorspaces::Image::Format::searchFormat(imageFromIce->description->format);<br>
<br> if (!fmt)<br> throw "Format not supported";<br><br><b> //Matriz de openCv con la imagen de Ice</b><br> cv::Mat matFromIce (imageFromIce->description->height, <br> imageFromIce->description->width,<br>
CV_8UC3,<br> &(imageFromIce->pixelData[0])); <br><br><b> //Matriz en grises</b><br> cv::Mat greyMat;<br><br><b> //Convierto a grises la imagen de la camara</b><br> cv::cvtColor(matFromIce, greyMat, CV_BGR2GRAY);<br>
<br> std::cout<< greyMat;<br><br> <b> //Paso la imagen greyMat al gui????<br> //Asi me coge lo que hay en la camara.</b><br> api->imageData1 = this->cprx1->getImageData();<br><br>
<br> pthread_mutex_unlock(&api->controlGui);<br>
<br> }<br><br><span style="font-family:arial,helvetica,sans-serif">Mi pregunta es: ¿Cómo hago para mostrar la imagen en el gui?<br>¿Como codifico la imagen de cv greyMat para pasarla a jderobot::ImageDataPtr y poderla visualizar en el GUI?<br>
<br>Un saludo</span><br></span>
<br>_______________________________________________<br>
Jde-developers mailing list<br>
<a href="mailto:Jde-developers@gsyc.es">Jde-developers@gsyc.es</a><br>
<a href="http://gsyc.escet.urjc.es/cgi-bin/mailman/listinfo/jde-developers" target="_blank">http://gsyc.escet.urjc.es/cgi-bin/mailman/listinfo/jde-developers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Alejandro Hernández Cordero<div><br></div><div><a href="http://www.linkedin.com/in/ahcorde/en" target="_blank"><img src="http://www.linkedin.com/favicon.ico"></a> <a href="https://twitter.com/ahcorde" target="_blank"><img src="http://www.twitter.com/favicon.ico"></a> <a href="https://plus.google.com/u/0/114434050324725472734/posts" target="_blank"><img src="https://ssl.gstatic.com/s2/oz/images/favicon.ico"></a> <a href="http://github.com/ahcorde" target="_blank"><img src="https://github.com/favicon.ico"></a><br>
</div><div><br></div><div>Play and visit my Curriculum vitae -> <a href="https://googledrive.com/host/0BytBL_SySiIjX19Pd1o5dlZaRHc/Game.html" target="_blank">https://googledrive.com/host/0BytBL_SySiIjX19Pd1o5dlZaRHc/Game.html</a></div>
</div>