Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
textons.h File Reference

Takes an image and represents the texture and colors in the image with a texton histogram. More...

#include <stdint.h>
+ Include dependency graph for textons.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void DictionaryTrainingYUV (uint8_t *frame, uint16_t width, uint16_t height)
 Function that performs one pass for dictionary training. More...
 
void DistributionExtraction (uint8_t *frame, uint16_t width, uint16_t height)
 Function that extracts a texton histogram from an image. More...
 
void save_texton_dictionary (void)
 Save the texton dictionary. More...
 
void load_texton_dictionary (void)
 Load a texton dictionary. More...
 
void textons_init (void)
 Initialize. More...
 
void textons_stop (void)
 
float get_entropy (float *p_dist, int D)
 Function that calculates a base-2 Shannon entropy for a probability distribution. More...
 

Variables

float * texton_distribution
 
uint8_t running
 
uint8_t load_dictionary
 
uint8_t reinitialize_dictionary
 
uint8_t alpha_uint
 
uint8_t n_textons
 
uint8_t patch_size
 
uint32_t n_learning_samples
 
uint32_t n_samples_image
 
uint8_t FULL_SAMPLING
 
uint32_t border_width
 
uint32_t border_height
 
uint8_t dictionary_number
 
uint8_t dictionary_ready
 
float alpha
 
float **** dictionary
 
uint32_t learned_samples
 
uint8_t dictionary_initialized
 

Detailed Description

Takes an image and represents the texture and colors in the image with a texton histogram.

A texton is a cluster centroid in a space populated by image patches. First, this code learns or loads a texton dictionary. Then, for each incoming image, patches are sampled from the image, compared to textons in the dictionary, and the closest texton is identified, augmenting the corresponding bin in the texton histogram.

Definition in file textons.h.

Function Documentation

◆ DictionaryTrainingYUV()

void DictionaryTrainingYUV ( uint8_t frame,
uint16_t  width,
uint16_t  height 
)

Function that performs one pass for dictionary training.

It extracts samples from an image, finds the closest texton and moves it towards the sample.

Parameters
[in]frame*The YUV image data
[in]widthThe width of the image
[in]heightThe height of the image

Definition at line 227 of file textons.c.

References alpha, alpha_uint, image_t::buf, dictionary, dictionary_initialized, frame, learned_samples, n_samples_image, n_textons, patch_size, s, and image_t::w.

Referenced by texton_func().

+ Here is the caller graph for this function:

◆ DistributionExtraction()

void DistributionExtraction ( uint8_t frame,
uint16_t  width,
uint16_t  height 
)

Function that extracts a texton histogram from an image.

Parameters
[in]frame*The YUV image data
[in]widthThe width of the image
[in]heightThe height of the image

Definition at line 372 of file textons.c.

References border_height, border_width, image_t::buf, dictionary, frame, FULL_SAMPLING, n_samples_image, n_textons, patch_size, and texton_distribution.

Referenced by texton_func().

+ Here is the caller graph for this function:

◆ get_entropy()

float get_entropy ( float *  p_dist,
int  D 
)

Function that calculates a base-2 Shannon entropy for a probability distribution.

Parameters
[in]p_distThe probability distribution array
[in]DSize of the array

Definition at line 594 of file textons.c.

References D.

◆ load_texton_dictionary()

void load_texton_dictionary ( void  )

Load a texton dictionary.

Definition at line 532 of file textons.c.

References dictionary, dictionary_initialized, dictionary_logger, dictionary_number, dictionary_ready, learned_samples, load_dictionary, n_textons, patch_size, and TEXTONS_DICTIONARY_PATH.

Referenced by texton_func().

+ Here is the caller graph for this function:

◆ save_texton_dictionary()

void save_texton_dictionary ( void  )

Save the texton dictionary.

Definition at line 501 of file textons.c.

References dictionary, dictionary_logger, dictionary_number, n_textons, patch_size, and TEXTONS_DICTIONARY_PATH.

Referenced by texton_func().

+ Here is the caller graph for this function:

◆ textons_init()

void textons_init ( void  )

Initialize.

Definition at line 562 of file textons.c.

References cv_add_to_device(), dictionary, dictionary_initialized, dictionary_ready, learned_samples, listener, MAX_N_TEXTONS, patch_size, texton_distribution, texton_func(), TEXTONS_FPS, and image_t::w.

+ Here is the call graph for this function:

◆ textons_stop()

void textons_stop ( void  )

Definition at line 583 of file textons.c.

References dictionary, and texton_distribution.

Variable Documentation

◆ alpha

◆ alpha_uint

uint8_t alpha_uint
extern

Definition at line 121 of file textons.c.

Referenced by DictionaryTrainingYUV(), and texton_func().

◆ border_height

uint32_t border_height
extern

Definition at line 128 of file textons.c.

Referenced by DistributionExtraction().

◆ border_width

uint32_t border_width
extern

Definition at line 127 of file textons.c.

Referenced by DistributionExtraction().

◆ dictionary

float** ** dictionary
extern

◆ dictionary_initialized

uint8_t dictionary_initialized
extern

Definition at line 41 of file textons.c.

Referenced by DictionaryTrainingYUV(), load_texton_dictionary(), texton_func(), and textons_init().

◆ dictionary_number

uint8_t dictionary_number
extern

Definition at line 129 of file textons.c.

Referenced by load_texton_dictionary(), and save_texton_dictionary().

◆ dictionary_ready

uint8_t dictionary_ready
extern

Definition at line 132 of file textons.c.

Referenced by load_texton_dictionary(), texton_func(), and textons_init().

◆ FULL_SAMPLING

uint8_t FULL_SAMPLING
extern

Definition at line 126 of file textons.c.

Referenced by DistributionExtraction().

◆ learned_samples

uint32_t learned_samples
extern

Definition at line 40 of file textons.c.

Referenced by DictionaryTrainingYUV(), load_texton_dictionary(), texton_func(), and textons_init().

◆ load_dictionary

uint8_t load_dictionary
extern

Definition at line 119 of file textons.c.

Referenced by load_texton_dictionary(), and texton_func().

◆ n_learning_samples

uint32_t n_learning_samples
extern

Definition at line 124 of file textons.c.

Referenced by texton_func().

◆ n_samples_image

uint32_t n_samples_image
extern

Definition at line 125 of file textons.c.

Referenced by DictionaryTrainingYUV(), and DistributionExtraction().

◆ n_textons

◆ patch_size

◆ reinitialize_dictionary

uint8_t reinitialize_dictionary
extern

Definition at line 120 of file textons.c.

Referenced by texton_func().

◆ running

uint8_t running
extern

Definition at line 118 of file textons.c.

Referenced by texton_func().

◆ texton_distribution

float* texton_distribution
extern