'Cat.Storage/SubCat.Research'에 해당되는 글 24건

  1. 2015.08.10 Reference Category
  2. 2015.07.20 getIFFT
  3. 2015.07.18 Fourier transform pairs
  4. 2015.07.10 FFT & DFT
  5. 2015.06.14 What is Filter bank
  6. 2015.05.26 What is CIELUV color space?
  7. 2015.05.23 k-means clustering
  8. 2015.05.20 On-the-fly multi-scale infinite texturing from example 2

reference: https://en.wikipedia.org/wiki/PEVQ


Depending on the information that is made available to the algorithm, video quality test algorithms can be divided into three categories:


A “Full Reference” (FR) algorithm has access to and makes use of the original reference sequence for a comparison (i.e. a difference analysis). It can compare each pixel of the reference sequence to each corresponding pixel of the degraded sequence. FR measurements deliver the highest accuracy and repeatability but tend to be processing intensive.

A “Reduced Reference” (RR) algorithm uses a reduced side channel between the sender and the receiver which is not capable of transmitting the full reference signal. Instead, parameters are extracted at the sending side which help predicting the quality at the receiving side. RR measurements may offer reduced accuracy and represent a working compromise if bandwidth for the reference signal is limited.

A “No Reference” (NR) algorithm only uses the degraded signal for the quality estimation and has no information of the original reference sequence. NR algorithms are low accuracy estimates, only, as the originating quality of the source reference is completely unknown. A common variant of NR algorithms don't even analyze the decoded video on a pixel level but work on an analysis of the digital bit stream on an IP packet level, only. The measurement is consequently limited to a transport stream analysis.



PEVQ is full-reference algorithm and analyzes the picture pixel-by-pixel after a temporal alignment (also referred to as 'temporal registration') of corresponding frames of reference and test signal. PEVQ MOS results range from 1 (bad) to 5 (excellent).


'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Feature vector in image processing  (0) 2015.08.15
Real-time infinite texturing from example - writing reference  (0) 2015.08.10
getIFFT  (0) 2015.07.20
Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
Posted by Cat.IanKang
,


//This algorithm includes auto shift so that the input data is gathered on center 

float getIFFT(float2 UV, float targetTextureSize)

{

float targetTexSize = targetTextureSize;

float2 Tex_xy = floor(UV * (targetTexSize - 1)); //transform to integer. 

float M = 13; //Only right square texture, preserved data size

float result = 0;

for (float u = 0; u < 13; ++u)

{

for (float v = 0; v < 13; ++v)

{

//float4 tx = microTX.SampleLevel(g_samLinear, float2(u / M, v / M), 0);

float a = MICRO_REAL[u][v];

float b = MICRO_IMAG[u][v];

//float u_ = (((targetTextureSize - 1.0f) / 2.0f - (M - 1.0f) / 2.0f) + u + (targetTextureSize + 1.0f) / 2.0f) % targetTextureSize;

//float v_ = (((targetTextureSize - 1.0f) / 2.0f - (M - 1.0f) / 2.0f) + v + (targetTextureSize + 1.0f) / 2.0f) % targetTextureSize;

float u_ = (507 + u) % 513;

float v_ = (507 + v) % 513;

float theta = 2 * IAN_PI *(Tex_xy.x * u_ / targetTexSize + Tex_xy.y * v_ / targetTexSize);

result += (a*cos(theta) - b*sin(theta));

}

}

result = result / targetTexSize / targetTexSize;

return result;

}

'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Real-time infinite texturing from example - writing reference  (0) 2015.08.10
Reference Category  (0) 2015.08.10
Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
What is Filter bank  (0) 2015.06.14
Posted by Cat.IanKang
,

For every time domain waveform, there is a corresponding frequency domain waveform, and vice versa. For example a rectangular pulse in the time domain coincides with the sinc function [i.e., sin(x)/x] in the frequency domain. Duality provides that the reverse is also true; a rectangular pulse in the frequency domain coincides with the sinc function in a time domain. Waveforms that correspond to each other in this manner are called Fourier transforms pairs. In this article, I will present several common pairs. I hope you enjoy. 


Let's look around a delta function in the time domain first. It is a simple waveform, and has an equally simple Fourier transform pair.  Assume that there is a delta function in the time domain, which has impulse at 0. Then, its frequency spectrum shows the constant magnitude, while the phase is entirely zero. Assume that the time domain waveform is shifted a few samples to the right (e.g., the delta function will have impulse at 4 ). Shifting the time domain waveform does not affect the magnitude, but adds a linear component to the phase. The following figures might help you to understand easily. 





Let's present the same information in the rectangular form. The pictures below show delta functions with the frequency domain in rectangular form. 






As is usually the case, the polar form is much easier to understand because the magnitude is just a constant value, while the phase is a simple line.  In comparison, the real and imaginary parts are sinusoidal oscillations which are difficult to understand.


The other interesting feature is the duality of the DFT(i.e. discrete fourier transform). Usually, each sample in the frequency domain corresponds to a sinusoid in the time domain. However, the reverse is also true: each sample in the time domain is corresponds to a sinusoid in the frequency domain. For instance, an impulse at sample number four ( 'd' of above picture) in the time domain results in four cycle of cosine function in the real part of the frequency spectrum, and four cycle of sine function in the imaginary part. 


As you recall, each sample in the time domain results in a cosine wave being added to real part of the frequency spectrum, and a negative sine wave being added to the imaginary part. The amplitude of each sinusoid is come from the amplitude of  each impulse in the time domain. 



* I think it's better to use "understand" than "catch the meaning". Usually, "catch the meaning" is better to use if you don't understand a certain expression in a language or literary stuff. Can be used for films too  


'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Reference Category  (0) 2015.08.10
getIFFT  (0) 2015.07.20
FFT & DFT  (0) 2015.07.10
What is Filter bank  (0) 2015.06.14
What is CIELUV color space?  (0) 2015.05.26
Posted by Cat.IanKang
,

http://paulbourke.net/miscellaneous/dft/


http://math.ewha.ac.kr/~jylee/SciComp/sc-crandall/fft.c


http://covil.sdu.dk/publications/MDobroczynski2DFFT2006.pdf


http://www.nayuki.io/res/free-small-fft-in-multiple-languages/fft.c




/* 

 * Free FFT and convolution (C)

 * 

 * Copyright (c) 2014 Project Nayuki

 * http://www.nayuki.io/page/free-small-fft-in-multiple-languages

 * 

 * (MIT License)

 * Permission is hereby granted, free of charge, to any person obtaining a copy of

 * this software and associated documentation files (the "Software"), to deal in

 * the Software without restriction, including without limitation the rights to

 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of

 * the Software, and to permit persons to whom the Software is furnished to do so,

 * subject to the following conditions:

 * - The above copyright notice and this permission notice shall be included in

 *   all copies or substantial portions of the Software.

 * - The Software is provided "as is", without warranty of any kind, express or

 *   implied, including but not limited to the warranties of merchantability,

 *   fitness for a particular purpose and noninfringement. In no event shall the

 *   authors or copyright holders be liable for any claim, damages or other

 *   liability, whether in an action of contract, tort or otherwise, arising from,

 *   out of or in connection with the Software or the use or other dealings in the

 *   Software.

 */


#include <math.h>

#include <stdlib.h>

#include <string.h>

#include "fft.h"



// Private function prototypes

static size_t reverse_bits(size_t x, unsigned int n);

static void *memdup(const void *src, size_t n);


#define SIZE_MAX ((size_t)-1)



int transform(double real[], double imag[], size_t n) {

if (n == 0)

return 1;

else if ((n & (n - 1)) == 0)  // Is power of 2

return transform_radix2(real, imag, n);

else  // More complicated algorithm for arbitrary sizes

return transform_bluestein(real, imag, n);

}



int inverse_transform(double real[], double imag[], size_t n) {

return transform(imag, real, n);

}



int transform_radix2(double real[], double imag[], size_t n) {

// Variables

int status = 0;

unsigned int levels;

double *cos_table, *sin_table;

size_t size;

size_t i;

// Compute levels = floor(log2(n))

{

size_t temp = n;

levels = 0;

while (temp > 1) {

levels++;

temp >>= 1;

}

if (1u << levels != n)

return 0;  // n is not a power of 2

}

// Trignometric tables

if (SIZE_MAX / sizeof(double) < n / 2)

return 0;

size = (n / 2) * sizeof(double);

cos_table = malloc(size);

sin_table = malloc(size);

if (cos_table == NULL || sin_table == NULL)

goto cleanup;

for (i = 0; i < n / 2; i++) {

cos_table[i] = cos(2 * M_PI * i / n);

sin_table[i] = sin(2 * M_PI * i / n);

}

// Bit-reversed addressing permutation

for (i = 0; i < n; i++) {

size_t j = reverse_bits(i, levels);

if (j > i) {

double temp = real[i];

real[i] = real[j];

real[j] = temp;

temp = imag[i];

imag[i] = imag[j];

imag[j] = temp;

}

}

// Cooley-Tukey decimation-in-time radix-2 FFT

for (size = 2; size <= n; size *= 2) {

size_t halfsize = size / 2;

size_t tablestep = n / size;

for (i = 0; i < n; i += size) {

size_t j;

size_t k;

for (j = i, k = 0; j < i + halfsize; j++, k += tablestep) {

double tpre =  real[j+halfsize] * cos_table[k] + imag[j+halfsize] * sin_table[k];

double tpim = -real[j+halfsize] * sin_table[k] + imag[j+halfsize] * cos_table[k];

real[j + halfsize] = real[j] - tpre;

imag[j + halfsize] = imag[j] - tpim;

real[j] += tpre;

imag[j] += tpim;

}

}

if (size == n)  // Prevent overflow in 'size *= 2'

break;

}

status = 1;

cleanup:

free(cos_table);

free(sin_table);

return status;

}



int transform_bluestein(double real[], double imag[], size_t n) {

// Variables

int status = 0;

double *cos_table, *sin_table;

double *areal, *aimag;

double *breal, *bimag;

double *creal, *cimag;

size_t m;

size_t size_n, size_m;

size_t i;

// Find a power-of-2 convolution length m such that m >= n * 2 + 1

{

size_t target;

if (n > (SIZE_MAX - 1) / 2)

return 0;

target = n * 2 + 1;

for (m = 1; m < target; m *= 2) {

if (SIZE_MAX / 2 < m)

return 0;

}

}

// Allocate memory

if (SIZE_MAX / sizeof(double) < n || SIZE_MAX / sizeof(double) < m)

return 0;

size_n = n * sizeof(double);

size_m = m * sizeof(double);

cos_table = malloc(size_n);

sin_table = malloc(size_n);

areal = calloc(m, sizeof(double));

aimag = calloc(m, sizeof(double));

breal = calloc(m, sizeof(double));

bimag = calloc(m, sizeof(double));

creal = malloc(size_m);

cimag = malloc(size_m);

if (cos_table == NULL || sin_table == NULL

|| areal == NULL || aimag == NULL

|| breal == NULL || bimag == NULL

|| creal == NULL || cimag == NULL)

goto cleanup;

// Trignometric tables

for (i = 0; i < n; i++) {

double temp = M_PI * (size_t)((unsigned long long)i * i % ((unsigned long long)n * 2)) / n;

// Less accurate version if long long is unavailable: double temp = M_PI * i * i / n;

cos_table[i] = cos(temp);

sin_table[i] = sin(temp);

}

// Temporary vectors and preprocessing

for (i = 0; i < n; i++) {

areal[i] =  real[i] * cos_table[i] + imag[i] * sin_table[i];

aimag[i] = -real[i] * sin_table[i] + imag[i] * cos_table[i];

}

breal[0] = cos_table[0];

bimag[0] = sin_table[0];

for (i = 1; i < n; i++) {

breal[i] = breal[m - i] = cos_table[i];

bimag[i] = bimag[m - i] = sin_table[i];

}

// Convolution

if (!convolve_complex(areal, aimag, breal, bimag, creal, cimag, m))

goto cleanup;

// Postprocessing

for (i = 0; i < n; i++) {

real[i] =  creal[i] * cos_table[i] + cimag[i] * sin_table[i];

imag[i] = -creal[i] * sin_table[i] + cimag[i] * cos_table[i];

}

status = 1;

// Deallocation

cleanup:

free(cimag);

free(creal);

free(bimag);

free(breal);

free(aimag);

free(areal);

free(sin_table);

free(cos_table);

return status;

}



int convolve_real(const double x[], const double y[], double out[], size_t n) {

double *ximag, *yimag, *zimag;

int status = 0;

ximag = calloc(n, sizeof(double));

yimag = calloc(n, sizeof(double));

zimag = calloc(n, sizeof(double));

if (ximag == NULL || yimag == NULL || zimag == NULL)

goto cleanup;

status = convolve_complex(x, ximag, y, yimag, out, zimag, n);

cleanup:

free(zimag);

free(yimag);

free(ximag);

return status;

}



int convolve_complex(const double xreal[], const double ximag[], const double yreal[], const double yimag[], double outreal[], double outimag[], size_t n) {

int status = 0;

size_t size;

size_t i;

double *xr, *xi, *yr, *yi;

if (SIZE_MAX / sizeof(double) < n)

return 0;

size = n * sizeof(double);

xr = memdup(xreal, size);

xi = memdup(ximag, size);

yr = memdup(yreal, size);

yi = memdup(yimag, size);

if (xr == NULL || xi == NULL || yr == NULL || yi == NULL)

goto cleanup;

if (!transform(xr, xi, n))

goto cleanup;

if (!transform(yr, yi, n))

goto cleanup;

for (i = 0; i < n; i++) {

double temp = xr[i] * yr[i] - xi[i] * yi[i];

xi[i] = xi[i] * yr[i] + xr[i] * yi[i];

xr[i] = temp;

}

if (!inverse_transform(xr, xi, n))

goto cleanup;

for (i = 0; i < n; i++) {  // Scaling (because this FFT implementation omits it)

outreal[i] = xr[i] / n;

outimag[i] = xi[i] / n;

}

status = 1;

cleanup:

free(yi);

free(yr);

free(xi);

free(xr);

return status;

}



static size_t reverse_bits(size_t x, unsigned int n) {

size_t result = 0;

unsigned int i;

for (i = 0; i < n; i++, x >>= 1)

result = (result << 1) | (x & 1);

return result;

}



static void *memdup(const void *src, size_t n) {

void *dest = malloc(n);

if (dest != NULL)

memcpy(dest, src, n);

return dest;

}

'Cat.Storage > SubCat.Research' 카테고리의 다른 글

getIFFT  (0) 2015.07.20
Fourier transform pairs  (0) 2015.07.18
What is Filter bank  (0) 2015.06.14
What is CIELUV color space?  (0) 2015.05.26
k-means clustering  (0) 2015.05.23
Posted by Cat.IanKang
,

In signal processing, a filter bank is an array of band-pass filters that separates the input signal into multiple components, each one carrying a single frequency sub-band of the original signal. The process of decomposition performed by the filter bank is called analysis which means analysis of the signal in terms of its components in each sub-band. The output of analysis is referred to as a sub-band signal with as many sub-bands as there are filters in the filter bank.  The reconstruction process is called synthesis, meaning reconstitution of a complete signal resulting from the filtering process. Following figure shows Gabor filter bank and its result. 





'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
What is CIELUV color space?  (0) 2015.05.26
k-means clustering  (0) 2015.05.23
On-the-fly multi-scale infinite texturing from example  (2) 2015.05.20
Posted by Cat.IanKang
,

  Reference: http://dcssrv1.oit.uci.edu/~wiedeman/cspace/me/infoluv.html


  The CIE, which stands for Commision Internationale de I'Eclairage (or International Commission on Illumination), in 1931, defined three standard primaries (X, Y, and Z) to replace red, green, and blue. It is inevitable since all visible colors could not be specified with only positive of red, green , and blue components. With this newly created X,Y, and Z primaries, all visible colors can be specified with only positive values of the primaries. Following picture shows the cone of visible colors, as well as the plane X+Y+Z=1. 


  Lowercase x,y, and z refer to the normalized X,Y and Z such that x = X/(X+Y+Z), y = Y/(X+Y+Z), and z = Z/(X+Y+Z). These lowercase letters are called chromaticity value. and a projection onto the (X,Y) plane of the (X+Y+Z = 1) plane of the above figure is called chromaticity diagram which is shown to following picture. The numbers along the boundary correspond to wavelength in nanometers.  


 The CIE LUV color space is a perceptually uniform derivation of this standard CIE XYZ space. Perceptually uniform means that two colors that are equally distant in the color space are equally distant perceptually). In this color space, the distance between two colors tells how different the colors are in luminance, chroma, and hue. 

'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
What is Filter bank  (0) 2015.06.14
k-means clustering  (0) 2015.05.23
On-the-fly multi-scale infinite texturing from example  (2) 2015.05.20
Posted by Cat.IanKang
,

Reference: http://en.wikipedia.org/wiki/K-means_clustering 


  k-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. It partitions n observations into k clusters in which each observation belongs to the cluster with the nearest mean. In terms of finding nearest mean, it uses squared Euclidean distance. Mathematically, this means partitioning the observations according to the Voronoi diagram generated by the means. 


 k-means clustering is NP-hard problem; however, there are efficient heuristic algorithms that are commonly employed and converge quickly to a local optimum. It is common that uses an iterative refinement. Following figure shows a brief description of the standard k clustering algorithm. 




As we mentioned above, The most common algorithm uses an iterative refinement technique. Given an initial set of k means m[1], ... , m[k], the algorithm proceeds by  alternating between two steps: assignment step and update step. 


Assignment step: Assign each observation to the cluster whose mean yields the least within-cluster sum of squares. Since the sum of squares is the squared Euclidean distance, this is intuitively the "nearest" mean. 


Update step: Calculate the new means to be the centroids of the observations in the new cluster. 


Initialization

  Forgy and Random Parition method usually uses for initialization. The Forgy method randomly choose k observations from the data set and uses these as the initial means. The Random Partition method first randomly assigns a cluster to each observation and then proceeds to calculate the new means to be the centroids of the observations in the new clusters. 

  The Forgy method tends to spread the initial means out, while Random Partition places all of them close to the center of the data set. In the standard k-means algorithms, the Forgy method is preferable as a initialization technique. 


Convergence

 As it is a heuristic algorithm, there is no guarantee that it will converge to the global optimum, and the result may depend on the initial cluster. As the algorithm is usually very fast, it is common to run it multiple times with different starting conditions. However, in the worst case, k-means can be very slow to converge: in particular it has been shown that there exist certain point sets, even in 2 dimensions, on which k-means takes exponential time to converge. 


'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
What is Filter bank  (0) 2015.06.14
What is CIELUV color space?  (0) 2015.05.26
On-the-fly multi-scale infinite texturing from example  (2) 2015.05.20
Posted by Cat.IanKang
,

1. Summary

This paper proposes a method for on-the-fly non-periodic infinite texturing of surfaces based on a single image

- Pattern repetition is avoided by defining patches within each texture whose content can be changed at run-time.

- Multi-scale is managed by using one input image per represented scale.  

- Undersampling artifacts are avoided by accounting for fine-scale features while colors are transferred between scales. 

- It allows for relief-enhanced rendering and provides a tool for intuitive creation of height maps. This is done using an adhoc local descriptor that measures feature self-similarity in order to propagate height values provided by the use for a few selected texels only. 

It is easy to implement on GPU because it is patch-based system.

2. Features

- Real-time non-periodic infinite surface texturing is achieved by modifying texture tiles at runtime, yet neither introducing visual artifacts nor requiring heavy computations. The memory consumption is also reduced compared to state-of-the-art tiling. 

- Multi-scale texturing consistently blends colors between multiple layers of texture: the color transfer mechanism avoids popping and ghosting artifacts by respecting the features of each scale.

- Relief enhancement is integrated as a height map texture, which is kept consistent with the color texture. 

3. Overview

 In this section, The process for mono-scale texturing will be described. 

3.1 Tile clustering and content selection

 As an input, it is given a set of tiles which are processed separately before the rendering stage. To break the repetition effect, the content of input will be randomly modified on-the-fly. Therefore, A tile partitioning is  pre-computed composed of patches with a set of interchangeable contents. All contents for a given patch have the same shape, but correspond to different locations in the tile.  At rendering, each time a tile is repeated the content of its patches is randomly selected. 

3.2 Fragmentation for multi-scale extension

 For rendering, the colors of two consecutive layers are blended according to the viewing distance. It requires colors to be transferred between scales. To minimize visual inconsistency such as popping, ghosting and blocky artifacts, the color is transferred on pre-computed fragments not on individual texels. Fragments are merely small pieces of textures, whose colors can be modified without introducing seams.  

3.3 Color conversion

 Fragments capture small features with a homogeneous color. which is decisive for multi-scale color transfer. In contrast, patches must encompass several texture features in order to break the repetition while keeping visual feature arrangements. Though fragment and patches have different properties, they have to be correlated each other, because content exchange which is performed per patch and color transfer which is performed per fragment will be combined at rendering. In addition, they share a common objective: hiding seams. It is achieved by exploiting fact that seams are less perceivable in regions of high contrast: fragments are computed such that their borders match high contrasts. 

A dedicated color space, that we call principal variation color space, is designed to meet several objective: to facilitate the building of fragments, and the measure of contrasts and seams. It allows to represent colors compactly and improve multi-scale anti-aliasing. It separates a few dominant colors from local variations for each texture tile. It is used throughout the process, and colors are converted back only at rendering. 

3.4 Relief enhancement

 If a height map is provided for the relief enhancement, it must be considered for the design of patches because content exchange may introduce geometric seams. Since patches are based on fragments which follow dominant colors, we introduce relief at the very beginning, as an additional coordinate to color channels. 



'Cat.Storage > SubCat.Research' 카테고리의 다른 글

Fourier transform pairs  (0) 2015.07.18
FFT & DFT  (0) 2015.07.10
What is Filter bank  (0) 2015.06.14
What is CIELUV color space?  (0) 2015.05.26
k-means clustering  (0) 2015.05.23
Posted by Cat.IanKang
,