Thread: How to use Linear Discriminant Analysis to identify an image

  1. #1
    Registered User
    Join Date
    Sep 2021
    Posts
    3

    How to use Linear Discriminant Analysis to identify an image

    I have a windows forms project and I have a dataset called the ATTDataSet, the folder has two folders, the training and testing folders, each contain similar images in the same order. I have a form with two picture box with the labels original image and recognized image. I need help with processing an image from the training folder to train this program to save the name of that image and identify a similar image in the testing folder with this algorithm Linear Discriminant Analysis.

    I want to train the program first to learn a face and with pattern program in c
    then later I will implement a button handler to identify all the images in the second folder with the same pattern as that which was recognized in the learn process. The code am using is below

    Code:
    [COLOR=var(--highlight-keyword)]using[/COLOR][COLOR=var(--highlight-color)] System;[/COLOR]
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Collections.Generic;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.ComponentModel;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Data;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Drawing;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Linq;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Text;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Threading.Tasks;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.Windows.Forms;
    [COLOR=var(--highlight-keyword)]using[/COLOR] System.IO;
    
    [COLOR=var(--highlight-keyword)]namespace[/COLOR] [COLOR=var(--highlight-literal)]LDA_FaceR[/COLOR]
    {
        [COLOR=var(--highlight-keyword)]public[/COLOR] [COLOR=var(--highlight-keyword)]partial[/COLOR] [COLOR=var(--highlight-keyword)]class[/COLOR] [COLOR=var(--highlight-literal)]Form1[/COLOR] : [COLOR=var(--highlight-literal)]Form[/COLOR]
        {
            [COLOR=var(--highlight-keyword)]public[/COLOR] [COLOR=var(--highlight-literal)]Form1[/COLOR]()
            {
                InitializeComponent();
            }
    
            [COLOR=var(--highlight-keyword)]private[/COLOR] [COLOR=var(--highlight-keyword)]void[/COLOR] [COLOR=var(--highlight-literal)]button1_Click[/COLOR]([COLOR=var(--highlight-literal)]object[/COLOR] sender, EventArgs e)
            {
                [COLOR=var(--highlight-comment)]//read the first image in the ATT data set folder[/COLOR]
              
                [COLOR=var(--highlight-literal)]string[/COLOR] path = [COLOR=var(--highlight-variable)]"C://Users//TimothyFarCry5//Documents//visual studio 2015//Projects//LDA-FaceR//LDA-FaceR//ATTDataSet//Training//S1_1.jpg"[/COLOR];
                Bitmap mymap = [COLOR=var(--highlight-keyword)]new[/COLOR] Bitmap(Image.FromFile(path));
                pictureBox1.Image = mymap;
                [COLOR=var(--highlight-comment)]//program so that the program intitiates an LDA sequence to learn the image[/COLOR]
                
    
            }
         [COLOR=var(--highlight-comment)]//this method tries to identify images from the second testing folder with the LDA[/COLOR]
         [COLOR=var(--highlight-comment)]//pattern stored in the learn process, please help[/COLOR]
           [COLOR=var(--highlight-keyword)]private[/COLOR] [COLOR=var(--highlight-keyword)]void[/COLOR] [COLOR=var(--highlight-literal)]button2_Click[/COLOR]([COLOR=var(--highlight-literal)]object[/COLOR] sender, EventArgs e)
            {
    
            }
        }
    }


    Update

    After digging online a little, I learned that I need to use classes to do this and I need to express the images in the database as a one dimension vector and then I should compute the mean and then subtract the mean from all images and then get eigenfaces. How do I express an image in the format shown below? The images have been expressed in vector form, how to do this is the problem and then later I can try to compute the mean.

    https://cboard.cprogramming.com/imag...BJRU5ErkJggg==

    This project is really important, Kudos to all who are willing to help.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Your post is a mess of markup (just like your other post as well).

    It's also in the wrong forum, looks more like C# than C.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linear regression and statistical analysis in c
    By bored_guy in forum C Programming
    Replies: 3
    Last Post: 05-04-2011, 12:38 AM
  2. Beam or Frame Analysis for Structural Analysis
    By greenmania in forum C Programming
    Replies: 3
    Last Post: 05-05-2010, 05:40 PM
  3. image analysis theory: mapping a network
    By elninio in forum C++ Programming
    Replies: 5
    Last Post: 10-30-2008, 01:23 PM
  4. Help!!!! How to Identify Image block or image separator in GIF 89a
    By kapil1089thekin in forum C Programming
    Replies: 1
    Last Post: 05-06-2008, 10:53 AM
  5. can you identify this car?
    By axon in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 07-19-2004, 02:59 PM

Tags for this Thread