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

8 次查看(过去 30 天)
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

采纳的回答

Drishti
Drishti 2024-8-8
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by