Poor Image quality when using montage without pauses. How can I check if quality has been lost?

6 views (last 30 days)
I'm using montage to create an image by overlaying two images with transparency. However, I've noticed that the resulting image sometimes appears blurry and of lower quality compared to the original images.
I have notice that pausing before montage (using debug or pause(0.5)) seems to improve the image quality.
since
montage(Im3d,'displayrange',displayrange,'size',size,'indices',indices,'parent',ax);
is different to
pause(0.5);
montage(Im3d,'displayrange',displayrange,'size',size,'indices',indices,'parent',ax);
Searching in the forum I've read that MATLAB switches the renderer to OpenGL for large 3d image, but I don't understand why inserting a pause improves things.
The question are
Is there a way to force montage to use all pixels during rendering, even if it takes longer?
Alternatively, is there a method to determine if MATLAB has resorted to approximations during the process?
Thanks for the help,
Matteo
  1 Comment
Drishti
Drishti on 7 Aug 2024
I tried to reproduce the code with images of my own but did not see any visible difference. Can you share the code and images that you worked on ?

Sign in to comment.

Accepted Answer

Drishti
Drishti on 8 Aug 2024
Hi Matteo,
I can conclude that you are trying to utilize the ‘montage’ function, and it seems to reduce the image quality when used without ‘pause’ function.
I tried reproducing the code with sample images and found no visible difference in the quality of image when ‘pause’ function is used with ‘montage’ function. The ‘pause’ function is halting the execution for mentioned period but not altering any pixel value of the image. Whereas ‘montage’ reduces the resolution of the image that leads to the reduction in image quality.
For utilising the complete image during rendering, one work around is to utilize ‘thumbnail.
% Generate the montage
%f = rand(100, 100, 10);
%random 3d image can be generated
f = imread('sample_image.jpg'); %sample image is used
img1 = montage(f);
pause(0.5);
img2 = montage(f);
% If you specify an empty array ([]), then the thumbnail size is full size of the image utilized.
img2 = montage(f,'ThumbnailSize', []);
For more information you can refer to the MATLAB Documentation
I hope it helps.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!