Image array as ImageSource for uiimage result in high jpg compression?

조회 수: 10 (최근 30일)
Johan C
Johan C 2020년 11월 5일
댓글: Joe S 2022년 7월 21일
I am doing some image processing on a image for a app. I have encountered a problem that the image shown by uiimage is low quality (maybe jpeg compression). The code example below shows two ways of displaying the same image with uiimage with two different results (right low quality, left normal).
Can i do something to stop the quality/compression ?
f = uifigure('Position',[20 20 440 210]);
im = uiimage(f,'Position',[10 10 200 200]);
im2 = uiimage(f,'Position',[230 10 200 200]);
imloadet = imread('membrane.png');
im.ImageSource = 'membrane.png';
im2.ImageSource = imloadet;
Thanks in advance for the help
  댓글 수: 3
Frans Muller
Frans Muller 2020년 11월 16일
편집: Frans Muller 2020년 11월 16일
same problem here i put on a color gradient, and it suffered similar compression or scaling issues distorting the gradient. in the end i made the image 2.25 larger then the pixels i needed the img to be and the scaling issue was less, but not gone. could it be something to do with the extend of windows magnification (display settings).
setting fit,stretch and scale options did not impact the issue. putting a 950 wide image ( same color in the whole column) in a uiimage 460 wide made a difference, but did not resolve it.
Johan C
Johan C 2020년 11월 17일
This might work for me to the quality to acceptable levels.
Thanks for the suggestions Frans, i appreciate it!

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

채택된 답변

Ashish Mishra
Ashish Mishra 2020년 11월 17일
This is the expected behavior for uiimage component.
ImageSource property accepts JPEG, PNG, GIF, SVG file formats along with m-by-n-by-3 truecolor image array.
Recommendation is to use image files directly such as PNG format for best quality in the above coding steps.
Truecolor image array is for convenience to support image array and other file formats not supported directly. Image quality might not be be best when using truecolor image array though.
  댓글 수: 2
Johan C
Johan C 2020년 11월 17일
Thanks for the answer Ashish. I guess I will have to save my post-processed images files to disk and load them directly to uiimage. I will say it is not the expected behavior when I read the documentation use of uiimage component.
Maybe is not the ideal component to display post processed images then.
Joe S
Joe S 2022년 7월 21일
I came across this issue as well. I was hoping to use the "uimage" in App Designer as a means to select and view particular slices in a 3D image dataset but there is clear compression issues (left) vs. when one uses imshow to a ui.Axes, which is free of compression artifacts (right). Unfortuantely, getting the images to fill the full "ui.Axes" and scale properly is a bit challenging, even after removing the ticklabels. Hopefully any compression level can be set for uiImage in future releases.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by