# pcaVisualize

## PURPOSE

Visualization of quality of approximation of X given principal comp.

## SYNOPSIS

function varargout=pcaVisualize( U, mu, vars, X, index, ks, fname, show )

## DESCRIPTION

     Visualization of quality of approximation of X given principal comp.

     X can either represent a single element (a single image or video), or a
     set of elements. In the latter case, index controls which element of X to
     apply visualization to, if unspecified it is chosen randomly.

     USAGE
      varargout=pcaVisualize(U, mu, vars, X, [index], [ks], [fname], [show])

     INPUTS
      U           - returned by pca.m
      mu          - returned by pca.m
      vars        - returned by pca.m
      X           - Set of images or videos, or a single image or video
      index       - [] controls which element of X to aplply visualization to
      ks          - [] ks values of k for pcaApply (ex. ks=[1 4 8 16])
      fname       - [] if specified outputs avis
      show        - [1] will display in figure(show) and figure(show+1)

     OUTPUTS
      M           - [only if X is a movie] movie of xhats (see pcaapply)
      MDiff       - [only if X is a movie] movie of difference images
      MU          - [only if X is a movie] movie of eigenmovies

     EXAMPLE

     See also PCA, PCAAPPLY

     Piotr's Image&Video Toolbox      Version 2.30
     Copyright 2009 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

- pcaApply Companion function to pca.
- im Function for displaying grayscale images.
- montage2 Used to display collections of images and videos.
- playMovie Shows/makes an/several movie(s) from an image sequence.
- figureResized Creates a figures that takes up certain area of screen.
- randint2 Faster but restricted version of randint.

This function is called by: