C# Class Action_Recognition_2._0.FeatureExtractor2D

显示文件 Open project: hornew/REU

Public Methods

Method Description
ExtractTrainingData ( string vidDir, string vidFileString, bool allFiles ) : void
FeatureExtractor2D ( ) : System
FeatureExtractor2D ( string path, int spSize, int tmpSize, int patches ) : System
SetProperties ( int spSize, int tmpSize, int patches ) : void

Function to change SpatialSize, TemporalSize, and NumPatches with a single call for the sake of convenience

ToMatrix ( Bitmap bm ) : Matrix

Copies the data from a Bitmap object into a Weka Matrix for purposes of matrix manipulation. Future consideration: Bitmap class's LockBits() function offers better performance for large-scale changes that SetPixel()

rgb2gray ( Bitmap bm ) : Bitmap

Row-wise iteration through the Bitmap, get the color from each pixel and change to grayscale. Refer to this link for explanation of conversion http://stackoverflow.com/questions/687261/converting-rgb-to-grayscale-intensity NOTE: In the future, consider converting Bitmap to Matrix here to set pixel value to integer instead of Color, essentially skipping the Color.FromArgb step

Private Methods

Method Description
FixFrame ( Bitmap map ) : Matrix

Grayscale and crop frames

GetBlock ( Matrix M, int xPos, int yPos, int tPos ) : Matrix[]

LoadClip ( string path ) : Matrix[]

Open the specified video and get the individual frames. Construct a 3D Matrix from the 2D matrices returned by the FixFrame function.

Reshape ( Matrix block, bool rowPacked ) : double[]

Takes a 3D Matrix (2D Matrix array) and copies the data into a single dimension vector (double array). Can be specified to copy data row - wise or column -wise from the input Matrix using the second parameter Functions differently from the Matlab version of Reshape in that this version assumes that the input Matrix will be reshaped into a single dimension. This functionality works for our purposes.

SetColumn ( Matrix m, int col, double vals ) : void

Sets a column of Matrix m specified by the index col to the values contained in the double array vals. Row dimension of Matrix m must match the length of array vals. Throws an exception if these dimensions do not match

Method Details

ExtractTrainingData() public method

public ExtractTrainingData ( string vidDir, string vidFileString, bool allFiles ) : void
vidDir string
vidFileString string
allFiles bool
return void

FeatureExtractor2D() public method

public FeatureExtractor2D ( ) : System
return System

FeatureExtractor2D() public method

public FeatureExtractor2D ( string path, int spSize, int tmpSize, int patches ) : System
path string
spSize int
tmpSize int
patches int
return System

SetProperties() public method

Function to change SpatialSize, TemporalSize, and NumPatches with a single call for the sake of convenience
public SetProperties ( int spSize, int tmpSize, int patches ) : void
spSize int
tmpSize int
patches int
return void

ToMatrix() public method

Copies the data from a Bitmap object into a Weka Matrix for purposes of matrix manipulation. Future consideration: Bitmap class's LockBits() function offers better performance for large-scale changes that SetPixel()
public ToMatrix ( Bitmap bm ) : Matrix
bm System.Drawing.Bitmap
return Matrix

rgb2gray() public method

Row-wise iteration through the Bitmap, get the color from each pixel and change to grayscale. Refer to this link for explanation of conversion http://stackoverflow.com/questions/687261/converting-rgb-to-grayscale-intensity NOTE: In the future, consider converting Bitmap to Matrix here to set pixel value to integer instead of Color, essentially skipping the Color.FromArgb step
public rgb2gray ( Bitmap bm ) : Bitmap
bm System.Drawing.Bitmap
return System.Drawing.Bitmap