JoseTlaseca
2nd June 2008, 23:44
Hello everybody...
I'm programming a tracking system... i'm using image sequences... i have a working application that shows the image sequence, this is the basic idea:
While(condition)
{
<some code...>
image = new QImage(fileName);//fileName is changing on every loop with something like /home/image0001.bmp... image0002.bmp... etc
<some code to refresh screen and show the imagen...>
}
But there's a problem... i create a new Qimage on every loop and increases the memory consumption... that's bad...
Well... i need to load an image on every loop in the same QImage object (image), then set empty the image object to load next of the sequence and show it without increasing memory consumption...
I think the better idea is something like:
// in the .h file:
QImage *image;
//in the .cpp file, in the constructor:
image = new QImage(width, height, 32);//an empty image with some size
//then in the while loop:
While(condition)
{
<some code...>
<here i need to load an image in "image" object...>
<some code to refresh screen and show the image...>
<finally i need to empty "image" object, because i'm gonna load in it the next image of the sequence...>
}
The problem is... i don't know how to do that...
Can you help me?
I'm programming with C++/QT3
Thank you anyway...
Jose
PS: Excuse me... but my english is really bad... hope you understand...
I'm programming a tracking system... i'm using image sequences... i have a working application that shows the image sequence, this is the basic idea:
While(condition)
{
<some code...>
image = new QImage(fileName);//fileName is changing on every loop with something like /home/image0001.bmp... image0002.bmp... etc
<some code to refresh screen and show the imagen...>
}
But there's a problem... i create a new Qimage on every loop and increases the memory consumption... that's bad...
Well... i need to load an image on every loop in the same QImage object (image), then set empty the image object to load next of the sequence and show it without increasing memory consumption...
I think the better idea is something like:
// in the .h file:
QImage *image;
//in the .cpp file, in the constructor:
image = new QImage(width, height, 32);//an empty image with some size
//then in the while loop:
While(condition)
{
<some code...>
<here i need to load an image in "image" object...>
<some code to refresh screen and show the image...>
<finally i need to empty "image" object, because i'm gonna load in it the next image of the sequence...>
}
The problem is... i don't know how to do that...
Can you help me?
I'm programming with C++/QT3
Thank you anyway...
Jose
PS: Excuse me... but my english is really bad... hope you understand...