Replacing value in satellite image.

1 次查看(过去 30 天)
Dear,
I have a Satellite image 10980x10980. Some value in this image are 9.3886e+36. I want to replace these pixel with value NaN to compute mean of this Image.
I tried to use img(img==9.3886e+36)=NaN but somehow it is not working at all. I try this with a small matrix 2x8 then it is work but with my image it is not replace anything at all. Can anyone help me to solve this?
Best regards,

采纳的回答

Image Analyst
Image Analyst 2020-9-14
Use ismembertol():
badPixels = ismembertol(img, 9.3886e+36, 1e36);
img(badPixels) = nan;
  6 个评论
Le Ngo Huy Phan
Le Ngo Huy Phan 2020-9-14
Ah yes, thank you. I still wonder why the img(img>=1000)=NaN not working. So strange tho
Image Analyst
Image Analyst 2020-9-14
That would work too. Just look:
img = randi(2000, 8, 6)
img(img>=1000)=NaN
img =
1946 347 1314 745 539 1333
1298 782 1256 397 846 1079
1601 1663 584 980 1096 1397
908 1607 864 679 1886 1334
865 121 31 1904 836 357
1651 799 1969 1841 1967 257
167 1054 335 106 603 1999
267 834 213 1476 1403 343
img =
NaN 347 NaN 745 539 NaN
NaN 782 NaN 397 846 NaN
NaN NaN 584 980 NaN NaN
908 NaN 864 679 NaN NaN
865 121 31 NaN 836 357
NaN 799 NaN NaN NaN 257
167 NaN 335 106 603 NaN
267 834 213 NaN NaN 343

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by