IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

lire des images à partir txt


Sujet :

C#

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    26
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 26
    Points : 16
    Points
    16
    Par défaut lire des images à partir txt
    Bonjour
    Je voudrais trouver une solution pour lire plusieurs image à partir d'un fichier.txt qui contient les lien des image bmp au lieu de pictureBox2 pour que je puisse comparer la première image avec les images dont leur path dans ce fichier txt

    Voici mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Dermalog.Afis.CodingMatching;
    using System.IO;
    namespace SimpleCMDemo
    {
    	public partial class Form1 : Form
    	{
    		private Dermalog.Afis.CodingMatching.FingerprintEncoder encoder = null;
    		private FingerprintTemplate[] twofingers = new FingerprintTemplate[2];
    		private bool isfirstfinger = true;
    		public Form1()
    		{
    			InitializeComponent();
    			try
    			{
     
    				encoder = new Dermalog.Afis.CodingMatching.FingerprintEncoder();
    				encoder.BeginEncoding += new BeginEncodingEventHandler(encoder_BeginEncoding);
    				encoder.EndEncoding += new EndEncodingEventHandler(encoder_EndEncoding);
    				encoder.ProgressEncoding += new ProgressEncodingEventHandler(encoder_ProgressEncoding);
                    encoder.EncodingError += new EncodingErrorEventHandler(encoder_EncodingError);
     
    			}
    			catch (Exception exp)
    			{
     
    				MessageBox.Show(exp.ToString());
    			}
    		}
     
        void encoder_EncodingError(object sender, EncodingErrorEventArgs e)
        {
          MessageBox.Show(e.Message);
        }
     
    		void encoder_ProgressEncoding(object sender, EncodingProgressEventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("ProgressEncoding " + e.Step.ToString());
    			if (statusStrip1.InvokeRequired)
    			{
    				ProgressEncodingEventHandler progress = new ProgressEncodingEventHandler(encoder_ProgressEncoding);
    				statusStrip1.Invoke(progress, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Value = e.Step;
    			}
    		}
     
    		void encoder_EndEncoding(object sender, EncodingEventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("EndEncoding");
    			if (statusStrip1.InvokeRequired)
    			{
    				EndEncodingEventHandler end = new EndEncodingEventHandler(encoder_EndEncoding);
    				statusStrip1.Invoke(end, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Visible = false;
    				if (IsFirstFinger)
    				{
     
    					twofingers[0] = e.Template;
    					qcBar1.Value = (int)twofingers[0].Quality;
    					isfirstfinger = false;
    				}
    				else
    				{
    					twofingers[1] = e.Template;
    					qcBar2.Value = (int)twofingers[1].Quality;
    					isfirstfinger = true;
     
    				}
     
    			}
    		}
     
    		void encoder_BeginEncoding(object sender, EventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("BeginEncoding");
    			if (statusStrip1.InvokeRequired)
    			{
    				BeginEncodingEventHandler begin = new BeginEncodingEventHandler(encoder_BeginEncoding);
    				statusStrip1.Invoke(begin, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Visible = true;
    			}
     
    		}
     
    		private void openToolStripMenuItem_Click(object sender, EventArgs e)
    		{
    			if (qcBar1.Value > 0)
    			{
    				qcBar1.Value = 0;
     
    			}
     
    			OpenFileDialog dlg = new OpenFileDialog();
    			dlg.Filter = "Bitmap Files|*.bmp";
    			if (dlg.ShowDialog(this) == DialogResult.OK)
    			{
    				if (IsFirstFinger)
    				{
    					pictureBox1.Image = Image.FromFile(dlg.FileName);
    					qcBar1.Value = 0;
    					encoder.EncodeAsynchronous(TemplateFormat.Dermalog, pictureBox1.Image);
     
    				}
     
     
    					pictureBox2.Image = Image.FromFile(dlg.FileName);
    					qcBar2.Value = 0;
    					encoder.EncodeAsynchronous(TemplateFormat.Dermalog, pictureBox2.Image);
    				}
     
    			}
    		}
     
    		private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    		{
    			Application.Exit();
    		}
     
    		private void btnCompare_Click(object sender, EventArgs e)
    		{
    			if (twofingers[0] != null && twofingers[1] != null)
    			{
    				MessageBox.Show(string.Format("Score = {0} ", Math.Round(twofingers[0].CompareTo(twofingers[1]))));
    			}
    		}
    		#region properties
    		private bool IsFirstFinger
    		{
    			get
    			{
    				return isfirstfinger;
    			}
    		}
    		#endregion
     
            private void pictureBox1_Click(object sender, EventArgs e)
            {
     
            }
     
            private void pictureBox2_Click(object sender, EventArgs e)
            {
     
            }
     
     
    	}
    }
    Merci de m'aider
    Images attachées Images attachées  

  2. #2
    Invité
    Invité(e)
    Par défaut
    Je n'ai pas forcer bien compris, mais je lirais le fichier txt ensuite je créerais un objet BMP via le contenu du fichier qui a été précédemment lut dans le fichier

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    26
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 26
    Points : 16
    Points
    16
    Par défaut
    au lieu de mettre la deuxième image et la comparer avec la première je propose de lire un fichier txt qui contient les path de plusieur bmp dans le disque dur pour que cette application compare la premiére bmp avec plusieur bmp

Discussions similaires

  1. Réponses: 6
    Dernier message: 26/12/2007, 11h03
  2. Réponses: 4
    Dernier message: 25/01/2007, 16h38
  3. lire des images BMP
    Par b_electronique dans le forum MFC
    Réponses: 4
    Dernier message: 18/05/2006, 18h20
  4. [FLASH 8] Afficher des images à partir d'une base de données
    Par developpeur_mehdi dans le forum Flash
    Réponses: 9
    Dernier message: 15/03/2006, 10h43
  5. Lire des images compressées pour Mac
    Par SpaceFrog dans le forum Autres Logiciels
    Réponses: 9
    Dernier message: 04/04/2005, 10h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo