imshow in GUI too slow
Afficher commentaires plus anciens
Hello, I've made a GUI that displays a series of images (250x500, jpg) in a portion (usually 5-10) of 36 existing axes. The axes are in a special pattern (so can not use montage) and sometimes overlapping. I am using IMSHOW to match images with axes (and imshow with blank images to erase the axes). These get updated about every 3-5 seconds, but take 2-3 seconds to display. I would like to make it display as fast as possible.
I've experimented using IMAGESC instead, but it has not sped this up at all. I've tried all three renderers and put direct buffering to no avail.
I read a very old post that reccomended not changing the image on each axis, but rather keeping the image and changing the image data using set(himage, 'CData', newdata) where new data is your MxNx3 uint8. So that I would store the images as a matrix and only update the image data. I tried this but it wouldn't cooperate with how I've written my parent code.
Although I think this may work, it would take a week to reconstruct the parent code. Are there any other methods I can try to avoid this?
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 26 Avr 2012
0 votes
Have you used the profiler to see that it's imshow that's the bottleneck and not imread or some other code?
8 commentaires
curran
le 26 Avr 2012
Image Analyst
le 26 Avr 2012
You aren't calling imshow() a bunch of times on the same axes are you? If you are, you can call cla reset before each one to speed it up. But it sounds like only one image is going into each axes, but I'm not sure what you mean by overlap. You mean like one axes control is partially on top of another?
curran
le 27 Avr 2012
Image Analyst
le 27 Avr 2012
Can you make up some code to generate a set of 36 250x500 images and display them and see how long it takes? Does it happen with the sample code, or just your code?
curran
le 27 Avr 2012
Image Analyst
le 27 Avr 2012
This is what I get:
test 1 call 0.749 s 0.102 s
imshow 36 call 0.396 s 0.043 s
That's 10 times faster than your computer. But your times are like 10 times faster than what you said. You said it takes as long as 5 seconds to display an image but your profiler shows 0.5 seconds. Maybe there's something going on in your computer that I just can't replicate.
curran
le 1 Mai 2012
Image Analyst
le 1 Mai 2012
So was mine. It was for 36 images, not just one image. See where it says "imshow 36" in my message. That means it was called 36 times, just like yours.
You don't have to live with it. Perhaps you just need a newer computer, like mine.
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!