How to save an image with 3D info in 2D form and read the image in a way that not reducing quality?

8 ビュー (過去 30 日間)
Rami Babayew
Rami Babayew 2023 年 3 月 21 日
編集済み: DGM 2023 年 3 月 21 日
Hi,
Im using matlab to do some phyisical and visual calculations for particle physics research.
Im working with tif high quality image and adding with the appdesigner few 3D artifacts.
In the buttom line i have to save the image in 2D and read it again, add another 3D artifact and then save it again in 2D (using For loop).
The problem is that the quality is deacreasing in each iteration. Its seems that theres a drift of the image (but i dont know why).
The code im using for save the image:
F = getframe ;
G = F.cdata;
H = imresize(G,[3264 4908]);
imwrite(H, Path_and_name)
The code fore reading:
background = imread(app.BackgroundPhotoSourceEditField_2.Value);
imshow(background);
the original image size is [3264 4908].
Ill be very gratful if you could help.
thx :-)

回答 (1 件)

DGM
DGM 2023 年 3 月 21 日
編集済み: DGM 2023 年 3 月 21 日
Do not save images by displaying them and capturing the figure. That's the same as taking a screenshot. It generally will not be the same size, and it will not generally be cropped correctly either. Given the size of the image and the resolution of most displays, it's likely that the image cannot be captured at full resolution even with tedious figure/axes manipulation and post-processing. It should be obvious that if you have to repeatedly resize the image, the results will be bad.
If you want to alter the image data in some way, work on the image itself. Whatever way that is, I don't know, because I don't know exactly what you're trying to do. It may be difficult to avoid figure capture in some cases, but even then, minimizing the number of times the data gets degraded should be an obvious goal.

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by