# doc-cache created by Octave 4.4.0
# name: cache
# type: cell
# rows: 3
# columns: 2
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
stscorr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1826

  This function implements the spatial-temporal speckle correlation [1] 
  technique. The correlation is applied between K0 image and
  all other images. 
  Use as input data a 3D matrix created grouping NTIMES intensity matrices I(k)
  1<=k<=NTIMES

  L    = [1:NTIMES]-K0
  LTau = L * Tau

  $corr(A,B)= \frac{E[(A-\mu_A)(B-\mu_B)]}{\sqrt{E[(A-\mu_A)^2]E[(B-\mu_B)^2]}}$

  $C(k)= corr(I(K0),I(k))$,  $\forall~1 \leq k \leq NTIMES$

  [1] ZDUNEK, A. et al. New nondestructive method based on spatial-temporal
      speckle correlation technique for evaluation of apples quality during
      shelf-life. International Agrophysics, v. 21, n. 3, p. 305-310, 2007. 

  After starting the main routine just type the following command at the
  prompt:
  C          = stscorr(DATA,Tau,K0)
  [C LTau]   = stscorr(DATA,Tau,K0)
  [C LTau L] = stscorr(DATA,Tau,K0)
  
  Input:
  DATA is the speckle data pack. Where DATA is a 3D matrix created grouping NTIMES 
       intensity matrices with NLIN lines and NCOL columns. When N=size(DATA), then
       N(1,1) represents NLIN and
       N(1,2) represents NCOL and
       N(1,3) represents NTIMES.
  Tau  is the sampling rate in seconds.
  K0   is the number of the reference frame used in correlation analysis.

  Output: 
  C    is the correlation vector. This corresponds with the C(l*tau) values used 
       in [1] at equation (7), with the difference that negative values of 
       l*tau also are calculated.
  LTau [Optional] is the vector with the values of time l*tau in the vector C. This
       can have negative values.
  L    [Optional] is the vector with the values of index l in the vector C. This
       can have negative values.


  For help, bug reports and feature suggestions, please visit:
  http://nongnu.org/bsltl/




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

  This function implements the spatial-temporal speckle correlation [1] 
  te



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
thsp2corr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1796

  This function implements the space-time speckle correlation [1] 
  technique. 
  Use as input data a matrix THSP  of M lines and NTIMES columns, that
  represents the intensity time evolution of M pixels in NTIMES samples.

  CORR(i,l) = corr( THSP(:,i) , THSP(:,i+l) ) 

  Correlation type 1:
  $corr(A,B)=\frac{E[AB]}{\sqrt{E[A^2]E[B^2]}}$

  Correlation type 2 (Pearson correlation):
  $corr(A,B)= \frac{E[(A-\mu_A)(B-\mu_B)]}{\sqrt{E[(A-\mu_A)^2]E[(B-\mu_B)^2]}}$

  $C(l) = \frac{1}{NTIMES/2}\sum\limits_{i=1}^{NTIMES/2} CORR(i,l)$, 

  [1] ZiJie Xu, Charles Joenathan, and Brij M. Khorana. 'Temporal and spatial 
      properties of the time-varying speckles of botanical specimens'. 
      In: Optical Engineering 34.5 (1995), pages 1487-1502. 

  After starting the main routine just type the following command at the
  prompt:
  C       = thsp2corr(THSP);
  C       = thsp2corr(THSP,2);
  [C L]   = thsp2corr(THSP);
  [C L]   = thsp2corr(THSP,2);
  
  Input:
  THSP is a integer 2D matrix that represents the time history speckle pattern (THSP). 
       This matrix can be obtained using the function THSP. It is necessary that the
       THSP matrix only has values between 0 and 255, the function does not
       verify. The function truncates values outside this  interval.
  TYPE [optional] indicates the type of correlation used. If TYPE=1 then it is used
       the correlation type 1, in other case, it is used the Pearson correlation.
       By default it is used the correlation type 1.

  Output: 
  C    is the correlation vector, with elements C(j) for all  0<=j<=NTIMES/2.
  L    is a vector with the times j of C(j). L=[0:NTIMES/2].


  For help, bug reports and feature suggestions, please visit:
  http://nongnu.org/bsltl/




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80

  This function implements the space-time speckle correlation [1] 
  techniqu





