The loop will set the last image as bacground image...
every time u use the setBackgroundBrush command, your previous brush will be overrided,,, isnt it ?
You will need to combine the images in list together into one image.
The loop will set the last image as bacground image...
every time u use the setBackgroundBrush command, your previous brush will be overrided,,, isnt it ?
You will need to combine the images in list together into one image.
Hi,
I didn't explained well.
I want the view to show image1, then image2, ... Imagine that the images are being grabbed from a web cam and I want to display them.
I know that I can use a QLabel, ... but I want to use Graphics View because I would like to insert some items on top of the image that have to be movable, resizable, ...
I have also tryied to add a pixmap item to the scene and update it from the images on the loop but I'm getting the same result.
Thanks,
Òscar Llarch i Galán
Hi,
As I said:
I used a QGraphicsPixmapItemI have also tryied to add a pixmap item to the scene and update it from the images on the loop but I'm getting the same result.
Also I tryied to use a Thread that emits the Images and the main thread updates the pixmap on the PixmapItem.
Thanks,
Òscar Llarch i Galán
Hi,
Why do I need more than one?
This gets me the same result.
Òscar Llarch i Galán
Maybe I don't understand what you are trying to do... Are you trying to show all images at once or one at a time?
Hi,
So, what I want is to show every image that is captured. The camera is not a webcam and it can reach up to 70fps.Imagine that the images are being grabbed from a web cam and I want to display them
I want to try if it is possible to show th 70fps in real time.
I use the GraphicsView because I can add items on top of the showed image and because I can use OpenGL when the system is able to use it.
Last edited by ^NyAw^; 8th May 2009 at 15:52.
Òscar Llarch i Galán
Hi,
I have tryied to use a QThread that emits the image pointers and the main thread only paints them. Instead of using QImage I have used QPixmap.
If I force the thread to sleep 5 ms every loop iterarion I'm able to paint at 170fps. If I try to enable OpenGL it paints at 170fps but only some images are displayed.
Any idea?
Thanks,
Òscar Llarch i Galán
What you are doing is asking for trouble but that's your choice. Anyway, your for() loop doesn't have a chance to show a sequence of images - you're iterating over all images at the same time so what you finally see is the last step of iteration. You don't need threads, all you need is to let Qt process events from time to time so that it has a chance to actually render something to the screen.
You can use timer to fire each iteration:
That will give some time for event processing between timeouts.Qt Code:
// somewhere, lets say in constructor of SomeClass: int m_i = 0; // class member connect(timer, SIGNAL(timeout()), SLOT(slotTimeout())); m_timer->start(20); // slotTimeout() void SomeClass::slotTimeout() { // insert your image ++m_i; // generally ++i is faster than i++ }To copy to clipboard, switch view to plain text mode
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
You can also use a QLabel inside the graphics view: QGraphicsScene::addWidget().
Bookmarks