uiimage introduces artifacts? How to fix?

조회 수: 1 (최근 30일)
Jamie
Jamie 2021년 1월 26일
댓글: Nitin Kapgate 2021년 2월 11일
I am building an application using App Designer and I am using images (Type = 'uiimage') and using the ImageSource property to display data. I am seeing artifacts on the GUI that are not in my data.
I can also produce the same behavior with a plain uiimage from the console.
img = ones(160, 160, 3, 'uint8') * 128;
img([48, 65], 1:4:end, :) = 0;
img([48, 65], 2:4:end, :) = 0;
fig = uifigure;
im = uiimage(fig);
im.ImageSource = img;
im.Position = [ 100, 100, 160, 160];
im.ScaleMethod = 'none';
The result from this is shown here:
Looking closely at the dashed lines shows the artifacts:
These look to me like jpeg artifacts. I am using ScaleMethod 'none' to try to rule out any resampling effects. In my application I am using a fixed size image that exactly matches the data size so it should not be performing scaling.
One of the purposes of my application is for users to closely scrutinize an image to look for artifacts in the underlying data, so it is important that the MxNx3 uint8 array is faithfully produced on the screen.
A "regular" figure with imshow does not show artifacts:
fig2 = figure;
imshow(img);
What's the best way to show the image in my application without artifacts?
  댓글 수: 3
Jamie
Jamie 2021년 2월 9일
Thank you, I am using 2019a. I can try 2020a and see if this has already been fixed. I'll report back what I find.
Jamie
Jamie 2021년 2월 9일
I have installed Matlab 2020b and I am seeing the same artifact with uifigure + uiimage.
This is the result from my 'ver' command:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.9.0.1570001 (R2020b) Update 4
MATLAB License Number: #######
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 19042)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.9 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
Parallel Computing Toolbox Version 7.3 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Also I notice your display says "Figure 1" with a toolbar. I would reemphasize that a regular figure + imshow works fine, and only the uifigure + uiimage has the issue.
You said you used uiimage, and I thought perhaps a regular figure + uiimage might be informative but apparently they do not work together.

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

채택된 답변

Nitin Kapgate
Nitin Kapgate 2021년 2월 10일
편집: Nitin Kapgate 2021년 2월 10일
Thank you @Jamie for bringing the issue of artifacts in the uifigure + uiimage workflow to my attention.
After revisiting the issue again, I could see artifacts being displayed when the image is displayed using the uifigure + uiimage workflow.
I have brought this issue to the concerned people and the issue might be resolved in future releases.
  댓글 수: 2
Jamie
Jamie 2021년 2월 10일
Thank you.
Nitin Kapgate
Nitin Kapgate 2021년 2월 11일
As a workaround, you can serve cdata as file:
imwrite(img, 'imgFile.png');
im.ImageSource = 'imgFile.png'

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by