why does imwrite change the image's pixel size?

I know it's odd, but imwrite command happens to change my image's pixel size. Does anyone have a proper explanation for this? Thank you

6 件のコメント

Rik
Rik 2018 年 10 月 6 日
編集済み: Rik 2018 年 10 月 6 日
Pixels don't have an inherent size, so what do you mean? Does the image size decrease? What code are you using?
Safa Ridene
Safa Ridene 2018 年 10 月 6 日
I tried to simply read my image in matlab and then write it under another name. And when i opened the new image in arcgis, i found out that the cell size decreased.
Rik
Rik 2018 年 10 月 6 日
I suspect that some metadata is not written the same way as it is stored in the original file. If you give more information about the file and show the code you're using we might be able to give you some guidance on how to add the metadata correctly.
If you simply want to copy the file (with or without renaming it), you can use the copyfile function.
Safa Ridene
Safa Ridene 2018 年 10 月 7 日
Thank you for your responses, I changed the config as mentioned in the link but it didn't solve the problem. I think Matlab has a default value for the pixel scale but I couldn't figure out how to change it.
Walter Roberson
Walter Roberson 2018 年 10 月 7 日
You should probably not be using imwrite for ArcGIS.
MATLAB has no default for pixel scale. Only a small number of image formats accept scale information for imwrite and if it is not provided by the user then imwrite does not emit it into the image. imwrite is rather restricted in the metadata it can write.

サインインしてコメントする。

回答 (1 件)

JESUS MARTINEZ
JESUS MARTINEZ 2020 年 4 月 1 日

0 投票

Hi, Sorry to bump into this thread but I have similar issue.
I am using some filters and I am feeding with an image of 50x50 pixels aprox, but the imwrite outputs a much larger file of 400x400 pixels aprox or so.
ITs frustrating cause I am trying to measure specific areas (in pixels) in both images but due to the resize...Its not apples to apples any longer.
Any help? thanks

6 件のコメント

Walter Roberson
Walter Roberson 2020 年 4 月 1 日
What filtering are you doing?
For example, conv2() will create a larger result unless you use 'same'
JESUS MARTINEZ
JESUS MARTINEZ 2020 年 4 月 1 日
Hello Thanks,
I am using threshold, sobel, canny, histeq adn a few more.
thanks
Walter Roberson
Walter Roberson 2020 年 4 月 2 日
I think we will need to see your code.
JESUS MARTINEZ
JESUS MARTINEZ 2020 年 4 月 3 日
HI thanks. resolved.
Ishtiaque Ahmed khan
Ishtiaque Ahmed khan 2020 年 8 月 30 日
@Jesus Martinez
Hello,
May I please know how you resolved the problem?
I am having same issue.
Please help.
Image Analyst
Image Analyst 2020 年 8 月 31 日
Start your own question and attach your image and code.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2018 年 10 月 6 日

コメント済み:

2020 年 8 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by