Efros-Leung
Exemplar-basedtexturesynthesis(Efros-Leung)
|
PCA (Principal Components Analysis) functions. More...
Go to the source code of this file.
Functions | |
float * | pca_generate_base (float *X, int m, int n, int k) |
Generate the matrix of ![]() | |
float * | pca_project (float *X, float *W, int k, int m, int n) |
Project the data on some axis. | |
float * | pca_project_vector (float *x, float *W, float *mean, int m, int k) |
Project a vector on some axis. | |
void | pca_generate_matrix (ImageF w, int t, float *gauss_wg, float **dictionaryU_out, float **dictionaryD_out, float **dictionaryR_out, float **dictionaryL_out, float **meanU, float **meanD, float **meanR, float **meanL) |
Extract all half-patches from the image. | |
void | pca (ImageF w, int t, int k, float *gauss_wg, float **WU, float **WD, float **WR, float **WL, float **YU, float **YD, float **YR, float **YL, float **meanU, float **meanD, float **meanR, float **meanL) |
Decompose all half-patches of the image in a PCA basis. | |
void | construct_dictionary_pca (ImageF w, float *gauss_wg_pca, int t, int k, float *YU, float *YD, float *YR, float *YL, float **dictionaryR, float **dictionaryL, float **dictionaryU, float **dictionaryD) |
Extract dictionaries and PCA projections from the image. | |
ImageF | pca_rgb (Cimage w) |
Convert a color image into a gray-scale image using a PCA on RGB channels. |
PCA (Principal Components Analysis) functions.
void construct_dictionary_pca | ( | ImageF | w, |
float * | gauss_wg_pca, | ||
int | t, | ||
int | k, | ||
float * | YU, | ||
float * | YD, | ||
float * | YR, | ||
float * | YL, | ||
float ** | dictionaryR, | ||
float ** | dictionaryL, | ||
float ** | dictionaryU, | ||
float ** | dictionaryD | ||
) |
Extract dictionaries and PCA projections from the image.
w | the image |
t | half-size of the patch (full size is ![]() |
gauss_wg_pca | Gaussian weights |
k | number of PCA components to be kept |
YU | pointer to the output projected data from all the upper half-patches |
YD | the same with the down part of patches |
YR | the same with the right part of patches |
YL | the same with the left part of patches |
dictionaryU | pointer to the output dictionary, dictionary will be extracted from all the upper half-patches |
dictionaryD | the same with the down part of patches |
dictionaryR | the same with the right part of patches |
dictionaryL | the same with the left part of patches |
void pca | ( | ImageF | w, |
int | t, | ||
int | k, | ||
float * | gauss_wg, | ||
float ** | WU, | ||
float ** | WD, | ||
float ** | WR, | ||
float ** | WL, | ||
float ** | YU, | ||
float ** | YD, | ||
float ** | YR, | ||
float ** | YL, | ||
float ** | meanU, | ||
float ** | meanD, | ||
float ** | meanR, | ||
float ** | meanL | ||
) |
Decompose all half-patches of the image in a PCA basis.
w | the image |
t | half-size of the patch (full size is ![]() |
k | number of PCA components to be kept |
gauss_wg | Gaussian weights |
WU | pointer to the output data, extracted from all the upper half-patches |
WD | the same with the down part of patches |
WR | the same with the right part of patches |
WL | the same with the left part of patches |
YU | pointer to the output projected data from all the upper half-patches |
YD | the same with the down part of patches |
YR | the same with the right part of patches |
YL | the same with the left part of patches |
meanU | pointer to the output mean for the upper parts |
meanD | pointer to the output mean for the down parts |
meanR | pointer to the output mean for the right parts |
meanL | pointer to the output mean for the left parts |
float* pca_generate_base | ( | float * | X, |
int | m, | ||
int | n, | ||
int | k | ||
) |
Generate the matrix of PCA axis.
Compute the PCA axis--i.e. the eigenvectors of and also the
matrix of size
in the SVD of
.
Select the eigenvectors with the largest eigenvalues.
X | data matrix, size ![]() |
m | dimension of the data |
n | number of data |
k | number of components to be kept |
void pca_generate_matrix | ( | ImageF | w, |
int | t, | ||
float * | gauss_wg, | ||
float ** | dictionaryU_out, | ||
float ** | dictionaryD_out, | ||
float ** | dictionaryR_out, | ||
float ** | dictionaryL_out, | ||
float ** | meanU, | ||
float ** | meanD, | ||
float ** | meanR, | ||
float ** | meanL | ||
) |
Extract all half-patches from the image.
Built dictionaries will be matrices of size containing
patches of dimensions
.
Consecutive values are all the components of a same patch (the columns of the dictionaries) with respect to Lapack column major order.
w | the image |
t | half-size of the patch (full size is ![]() |
gauss_wg | Gaussian weights |
dictionaryU_out | pointer to the output dictionary, dictionary will be extracted from all the upper half-patches |
dictionaryD_out | the same with the down part of patches |
dictionaryR_out | the same with the right part of patches |
dictionaryL_out | the same with the left part of patches |
meanU | pointer to the output mean, computed on all the upper half-patches |
meanD | the same with the down part of patches |
meanR | the same with the right part of patches |
meanL | the same with the left part of patches |
float* pca_project | ( | float * | X, |
float * | W, | ||
int | k, | ||
int | m, | ||
int | n | ||
) |
Project the data on some axis.
X | data matrix, size ![]() |
W | projection axis, size ![]() |
k | number of dimension kept by PCA |
m | dimension of the data |
n | number of data |
float* pca_project_vector | ( | float * | x, |
float * | W, | ||
float * | mean, | ||
int | m, | ||
int | k | ||
) |
Project a vector on some axis.
x | data vector, size ![]() |
mean | mean vector to use for ![]() ![]() |
W | projection axis, size ![]() |
k | number of dimension kept by PCA |
m | dimension of the data |