How do I show a IplImage in a gtk.Image?

*Joseph Soares Alcântara*
Engenharia da Computação - 8º semestre
Universidade Federal do Ceará - UFC
Sobral - Ceará

+--------------------------------------------------------------------------+
.| - °v°...A liberdade não pode ser comprada e sim     |
.| -/(_)\..conquistada. Conquiste a sua também use   |
.| - ^^                  G N U / L I N U X                          |
+--------------------------------------------------------------------------+



2012/2/21 Joseph S. Alcântara <[email protected]>

> I cannot access FAQ, I think it's not working now.
> Don't you have any example how could I solve that?
> Yes, I'd like to show image from cv.QueryFrame in a gtk.Image, But I am
> new in this, I'm learning a little slow.
> It's a project to the university. We have an Open Source Study Group, and
> I have to create a program using python + opencv + gtk.
>
> Thank you
>
> *Joseph Soares Alcântara*
> Engenharia da Computação - 8º semestre
> Universidade Federal do Ceará - UFC
> Sobral - Ceará
>
>
> +--------------------------------------------------------------------------+
> .| - °v°...A liberdade não pode ser comprada e sim     |
> .| -/(_)\..conquistada. Conquiste a sua também use   |
> .| - ^^                  G N U / L I N U X                          |
>
> +--------------------------------------------------------------------------+
>
>
>
> 2012/2/21 John Stowers <[email protected]>
>
>> IIRC opecv starts a mainloop when create window is called.
>>
>> In general, don't use threads unless you have read the FAQ and
>> understand what you are doing.
>>
>> John
>>
>> 2012/2/21 Joseph S. Alcântara <[email protected]>:
>> > Even if I don't use, ie, if I comment the lines where NamedWindow,
>> ShowImage
>> > and WaitKey appear it freezes too.
>> >
>> > Joseph Soares Alcântara
>> > Engenharia da Computação - 8º semestre
>> > Universidade Federal do Ceará - UFC
>> > Sobral - Ceará
>> >
>> >
>> +--------------------------------------------------------------------------+
>> > .| - °v°...A liberdade não pode ser comprada e sim     |
>> > .| -/(_)\..conquistada. Conquiste a sua também use   |
>> > .| - ^^                  G N U / L I N U X                          |
>> >
>> +--------------------------------------------------------------------------+
>> >
>> >
>> >
>> > 2012/2/21 John Stowers <[email protected]>
>> >>
>> >> GTK is not threadsafe.
>> >>
>> >> If opencv shows a gtk mainwindow in cv.ShowImage, and that occurs in a
>> >> different thread to the one running gtk_main, then unpredictable
>> >> crashes and odd behaviour will result.
>> >>
>> >> Please check the pygtk FAQ for how to use threading and pygtk.
>> >>
>> >> I suggest displaying the image yourself in by getting the data from
>> >> the IPL image and copying it into a GtkImage. Or be much more careful
>> >> with which operations you do in which thread (i.e. cv.ShowImage,
>> >> cv.WaitKey)
>> >>
>> >> John
>> >>
>> >> 2012/2/21 Joseph S. Alcântara <[email protected]>:
>> >> > Hi, Thank you for response to me.
>> >> >
>> >> > See, can I sand you my program to you see what I am making? I've used
>> >> > Thread, but seems like is not working like I want.
>> >> >
>> >> > You must run from main.py
>> >> >
>> >> > Joseph Soares Alcântara
>> >> > Engenharia da Computação - 8º semestre
>> >> > Universidade Federal do Ceará - UFC
>> >> > Sobral - Ceará
>> >> >
>> >> >
>> >> >
>> +--------------------------------------------------------------------------+
>> >> > .| - °v°...A liberdade não pode ser comprada e sim     |
>> >> > .| -/(_)\..conquistada. Conquiste a sua também use   |
>> >> > .| - ^^                  G N U / L I N U X                          |
>> >> >
>> >> >
>> +--------------------------------------------------------------------------+
>> >> >
>> >> >
>> >> >
>> >> > 2012/2/19 Hart's Antler <[email protected]>
>> >> >>
>> >> >> Hi Joseph,
>> >> >> I got GTK and OpenCV working together using threads.  This example
>> >> >> works
>> >> >> with CPython2, CPython3 and PyPy, see my blog post.
>> >> >> http://pyppet.blogspot.com/2011/12/rpythonic-044.html
>> >> >>
>> >> >> -brett-
>> >> >>
>> >> >> ________________________________
>> >> >> From: Joseph S. Alcântara <[email protected]>
>> >> >> To: [email protected]
>> >> >> Sent: Sunday, February 19, 2012 9:46 AM
>> >> >> Subject: [pygtk] PyGTK + OpenCV
>> >> >>
>> >> >> hi, I'm writing a application that uses pygtk and opencv. and I had
>> a
>> >> >> problem. When I run the program it shows a gui. So far so good. But,
>> >> >> when  I
>> >> >> click in a menuitem, it should call a functino that runs the famous
>> >> >> routine
>> >> >> to show a video from webcam. But in this moment, the app freezes. I
>> >> >> have
>> >> >> tried to use thread, but opencv gui runs just after I call
>> >> >> gtk.main_quit().
>> >> >> What could solve my problem? Thanks.
>> >> >>
>> >> >> Estou escrevendo um programa em python, usando pygtk e opencv.
>> Quando
>> >> >> rodo
>> >> >> o programa, aparece uma janela e até aí, beleza. Mas quando eu
>> clico em
>> >> >> um
>> >> >> menuitem, ele deve chamar uma função que roda a famosa rotina que
>> exibe
>> >> >> um
>> >> >> vídeo a partir da webcam. No entanto, neste momento, o programa
>> trava.
>> >> >> Então, eu tentei usar Thread, mas a parte do opencv só roda depois
>> que
>> >> >> eu
>> >> >> fecho a janela, chamando gtk.main_quit(). O que poderia ser?
>> Obrigado
>> >> >> desde
>> >> >> já.
>> >> >>
>> >> >> Joseph Soares Alcântara
>> >> >> Engenharia da Computação - 8º semestre
>> >> >> Universidade Federal do Ceará - UFC
>> >> >> Sobral - Ceará
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> +--------------------------------------------------------------------------+
>> >> >> .| - °v°...A liberdade não pode ser comprada e sim     |
>> >> >> .| -/(_)\..conquistada. Conquiste a sua também use   |
>> >> >> .| - ^^                  G N U / L I N U X
>> |
>> >> >>
>> >> >>
>> >> >>
>> +--------------------------------------------------------------------------+
>> >> >>
>> >> >>
>> >> >> _______________________________________________
>> >> >> pygtk mailing list  [email protected]
>> >> >> http://www.daa.com.au/mailman/listinfo/pygtk
>> >> >> Read the PyGTK FAQ: http://faq.pygtk.org/
>> >> >>
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > pygtk mailing list   [email protected]
>> >> > http://www.daa.com.au/mailman/listinfo/pygtk
>> >> > Read the PyGTK FAQ: http://faq.pygtk.org/
>> >
>> >
>>
>
>
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to