I have a folder that contains 200 images. I loaded all these images into an array list of type image called training
. I have a problem converting this to a one dimension vector. I need help with this, am writing a PCA based solution for face recognition, Thank You.
List<Image> training = new List<Image>();
//the path to the images
static string path = "C:/Users/User/Documents/visual studio 2015/Projects/PCA/PCA/training";
public Form1()
{
InitializeComponent();
}
//the method below starts the training process
private void button1_Click(object sender, EventArgs e)
{
/*read all the images in the training folder into an array
in this case the images are already in gray scale so we do not need to convert
*/
var files = Directory.GetFiles(path);
foreach(string r in files)
{
if(Regex.IsMatch(r, @"\.jpg$|\.png$|\.gif$"))
{
training.Add(Image.FromFile(r));
}
}
//convert the list of images to a one dimension vector
}
Update
I have a variable called matrix data
which has been initialized to size [200,92*112]
, and then I have this list training, I need to loop through all the images in the list and access a pixel
and assign that to the matrix_data
. I think am now clear, how do achieve this?