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)

EX_G

Excess Green, defined as

\[2G - 1R - 1B\]

MEX_G

Modified Excess Green, defined as

\[1.262G - 0.884R - 0.331B\]

EX_GR

Excess Green Minus Red, defined as

\[3G - 2.4R - B\]

NDI

Normalized Difference Index, defined as

\[\frac{G - R}{G + R}\]

VEG

Vegetative Index, defined as

\[\frac{G}{R^{a} * B^{1-a}}\]

NDVI

Normalized Difference Vegetation Index

\[\frac{n - r}{n + r}\]

BNDVI

Blue Normalized Difference Vegetation Index

\[\frac{n - b}{n + b}\]

GNDVI

Green Normalized Difference Vegetation Index

\[\frac{n - g}{n + g}\]

GARI

Green Atmospherically Resistant Vegetation Index

\[\frac{n - g + b - r}{n - g - b + r}\]

GLI

Green Leaf Index

\[\frac{2 * g - r - b}{2 * g + r + b}\]

GBNDVI

Green Blue Normalized Difference Vegetation Index

\[\frac{n - b}{n + b}\]

GRNDVI

Green Red Normalized Difference Vegetation Index

\[\frac{n - g}{n + g}\]

NDRE

Normalized Difference Red Edge

\[\frac{n - e}{n + e}\]

LCI

Leaf Chlorophyll Index

\[\frac{n - e}{n + r}\]

MSAVI

Modified Soil Adjusted Vegetation Index

\[\begin{split}X = (2n + 1) \\ (X - \sqrt{X^2 - 8 (n - r)}) / 2\end{split}\]

OSAVI

Optimized Soil Adjusted Vegetation Index

\[\frac{n - r}{n + r + 0.16}\]

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.