imshow in GUI too slow
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
Image Analyst
2012년 4월 26일
0 개 추천
Have you used the profiler to see that it's imshow that's the bottleneck and not imread or some other code?
댓글 수: 8
curran
2012년 4월 26일
Image Analyst
2012년 4월 26일
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
2012년 4월 27일
Image Analyst
2012년 4월 27일
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
2012년 4월 27일
Image Analyst
2012년 4월 27일
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
2012년 5월 1일
Image Analyst
2012년 5월 1일
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.
카테고리
도움말 센터 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!