Frame Channel¶
Channel2D Class is deprecated from 0.0.3 onwards, replaced by the current in-built methods
Getting Channels¶
>= 0.1.0
There is a new convention of getting channels.
View some examples here: Getting Started
The new format, uses the following calling template
f: Frame2D
f.get_chns(chns:List[f.CHN, str])
The f.CHN consts are essentially strings
For example
f: Frame2D
f.get_chns([f.CHN.HSV, f.CHN.EX_G, f.CHN.VEG])
f.CHN.XX are all str variants, so you can also call using strings, though, will lack validation.
f: Frame2D
f.get_chns(self_=True, chns=['HUE', 'SATURATION']) # Other arguments omitted
Slicing¶
New in 0.0.6
You can now slice like NumPy for the dimensions
f: Frame2D
f[..., f.CHN.RED]
f[0:100, 200:300, f.CHN.RGB]
Retriving GLCM¶
For GLCM, you need to specify its feature and the channel.
See the available features here: Available Channels
f: Frame2D
f.COR(f.CHN.RED)
Formulas¶
Below, we list all formulas that are used to calculate each index.
R: Red Wide, G: Green Wide, B: Blue Wide.
r: Red Narrow, g: Green Narrow, b: Blue Narrow, e: Red Edge, n: Near Infared
GLCM¶
GLCM is detailed in the GLCM Implementation Page.
XY¶
The XY coordinate for every Pixel
HSV¶
HSV (Hue, Saturation, Value)
MSAVI¶
Modified Soil Adjusted Vegetation Index
Module Info¶
-
class
frmodel.base.D2.frame._frame_channel._Frame2DChannel¶ Bases:
frmodel.base.D2.frame._frame_channel_fast_glcm._Frame2DChannelFastGLCM,frmodel.base.D2.frame._frame_channel_spec._Frame2DChannelSpec-
_EX_G() → numpy.ndarray¶ Calculates the excessive green index
2g - 1r - 1b
-
_EX_GR() → numpy.ndarray¶ Calculates the excessive green minus excess red index
2g - r - b - 1.4r + g = 3g - 2.4r - b
- Returns
np.ndarray, similar shape to callee. Use _get_chns to get as Frame2D
-
_HSV() → numpy.ndarray¶ Creates a HSV
-
_MEX_G() → numpy.ndarray¶ Calculates the Modified excessive green index
1.262g - 0.884r - 0.331b
-
_NDI() → numpy.ndarray¶ Calculates the Normalized Difference Index
(g - r) / (g + r)
- Returns
np.ndarray, similar shape to callee. Use _get_chns to get as Frame2D
-
_VEG(const_a: float = 0.667) → numpy.ndarray¶ Calculates the Vegetative Index
g / {(r^a) * [b^(1 - a)]}
- Parameters
const_a – Constant A depends on the camera used.
- Returns
np.ndarray, similar shape to callee. Use _get_chns to get as Frame2D
-
_XY() → numpy.ndarray¶ Creates the XY Coord Array
- Returns
np.ndarray, similar shape to callee. Use _get_chns to get as Frame2D
-
get_chns(chns: Iterable[Frame2D.CHN, str] = ()) → Frame2D¶ Gets selected channels
Use _get_all_chns to get all but selected ones
- Parameters
chns – Channels, can be also in strings.
- Returns Frame2D
Itself as a reference.
-