Resizing of large images in 2019a low quality compared to 2014a.

조회 수: 2 (최근 30일)
Kristen Meyer
Kristen Meyer 2019년 6월 19일
편집: Kristen Meyer 2019년 7월 19일
Hi,
I am creating some color mapped plots with imagesc and a custom colormap. The created plot is resized by matlab as it is too big, which is fine, however, the way matlab does the resizing seems to be different between 2014a and 2019a. I have included two images created on the same computer with the exact same data and code: image 1 is created in 2014a, image 2 is created in 2019a. If I zoom into both the 2019a and 2014a images they do look the same, which makes me think that 2019a is corase with its resizing. Things I have attempted are: to make the plots as large as possible to minimize resizing, I tried printing to a vector file, downsampling the datapoints, turning off image smoothing, and I have tried to render with zbuffer, openGL, and painters. I am using a VM and do not have a gpu so I cannot test hardware openGL. My goal is to have the plots look the same between 2014a and 2019a. Or at least remove the diagonal grey lines.
Here is a code snippet from the function that creates the image. It scales down the data to the data limits and then creates the image with imagesc. The data matrix is 65x2880. z is the data matrix. xl, yl, and zl are x axes limits, y axes limits, and data matrix limits respectively.
%% define the area to plot, axis, scale down the data
xyLim = [xl(1) xl(2) min(yl) max(yl)];
ix = find( x >= xyLim(1) & x <= xyLim(2) );
xa = x(ix);
iy = find( y >= xyLim(3) & y <= xyLim(4) );
ya = y(iy);
z = z(iy,ix);
% scale values beyond the limits to the limits
z(z < zl(1)) = zl(1);
z(z > zl(2)) = zl(2);
% prevent CLIM errors if the z limits are equal or zero
if all(zl == 0)
zl = [-0.01 0.01];
elseif zl(1) == zl(2)
zl(2) = zl(2) + 0.01*abs(zl(2));
end
%% make a custom colour bar
dz = (zl(2) - zl(1)) / (cmapCumSum(cmapIndex+1) - cmapCumSum(cmapIndex) - 2); % the delta is the diff divided by (range - 1). Excluding the NaN color, so add another -1
zscal = zl(1)+ dz:dz:zl(2) - dz;
cbarHandle = subplot('Position', [sa(1)+sa(3)*.95+0.02 ,sa(2)+0.006, sa(3)*0.05, sa(4)]);%vert offset of 0.006 added so colourbar is level with plots
imagesc([0 1], zl, zscal', [zl(1) zl(2)]);
colormap(cm);
title(units, 'Fontsize',fs, 'Fontweight', 'Normal');
set(cbarHandle, 'xtick',[], 'XTickLabel',[], 'YDir','normal', 'FontSize',fs, 'YaxisLocation','right');
%% plot the 2D color image/data
imageAxisH = subplot('Position',[sa(1) sa(2) sa(3)*0.95 sa(4)]);
imagesc(xa, ya, z, [zl(1) - dz zl(2)]); % do a trick with the CLim so that NaNs never get confused with real values
Thanks,
K
  댓글 수: 1
Kristen Meyer
Kristen Meyer 2019년 6월 27일
편집: Kristen Meyer 2019년 7월 19일
Got though to support and after a bit of time they provided me with a much better workaround than I had done myself. after calling img=imagesc(x,y,z) then you can set the max texture size with img.MaxTextureSize=5000. This greatly improves the software based rendering representation and makes it close to how rendering was done in R2014a. This is not an issue if a gpu exists in the system and hardware rendering is chosen.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Visual Exploration에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by