Will imtranslate 'Fill Values' to NaN rather than an actual color ?

조회 수: 3 (최근 30일)
raheem mian
raheem mian 2019년 9월 24일
댓글: Athul Prakash 2019년 9월 27일
I want to fill values as NaN to the resulting image matrix rather than the default 0. Is this possible ?
  댓글 수: 4
rough93
rough93 2019년 9월 25일
In this case if you know what values you'll have in the output, I'd suggest finding a value you know won't occur. For example, if you know you'll have 0s, 1s, and 2s, give the pixels you wanted to be NaN a value of 3.
Athul Prakash
Athul Prakash 2019년 9월 27일
if you must use NaN, then maybe you could write a script to do that manually:
i(a:b, c:d, :) = nan %set all values to nan in the region bounded by coordinates a,b,c,d
Please be aware that if the data type for the array is integral (which is most common), the array won't accept nan values. In this case, the portion of the array you set to NaN will get filled with 0's. [a variable of integral type cannot store a NaN value]
In my opinion, the way to do this is to record the portion you wish to NaN-fill. Save them as co-ordinates of a box.
Fill them with 0's, not NaN.
Then use the saved co-ordinates in your later analysis to treat those filled 0's differently from 0's which were a part of your original image.
Hope it Helps!

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by