COMPARER LES 2 IMAGES AFIN D'EN CONAITRE LA VALEUR NUMERIQUE
khemarak
Messages postés5Date d'inscriptionmercredi 29 septembre 2010StatutMembreDernière intervention23 septembre 2011
-
21 sept. 2011 à 09:22
NHenry
Messages postés15090Date d'inscriptionvendredi 14 mars 2003StatutModérateurDernière intervention 6 novembre 2023
-
21 sept. 2011 à 12:11
Bonjour ,
j'ai un probleme d'implantation la code dans mon logiciel car je ne sais pas cobien au total les commande qui sont dans la boite à outil à utilser voilà la code dont j'ai trouvé sur le net :
Private Sub controleTirageNumeros()
Dim largeurTirage As Byte = 21
Dim hauteurTirage As Byte = 21
Dim trouvenumero As Boolean = False
' Dim screenshot As Bitmap
Dim bounds As Rectangle
Dim graph As Graphics
Dim tirage As Bitmap
bounds = Screen.PrimaryScreen.Bounds
trouvenumero = False
' SI L'HISTORIQUE N' A PAS CHANGE ALORS ONE NE COMPARE PAS LES NUMEROS
If gHistoChange = False Then Exit Sub
' ET ON AFFICHE LE NOUVEL HISTORIQUE DANS LE PICIMAGE !!!
'ON LIT LE NUMERO A L'ECRAN
tirage = New System.Drawing.Bitmap(largeurTirage, hauteurTirage, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(tirage)
graph.CopyFromScreen((gscreenCasinoX - 4) + 447, (gscreenCasinoY - 4) + 64, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
' RESTE A COMPARER LES 2 IMAGES AFIN D'EN CONAITRE LA VALEUR NUMERIQUE
' IL NOUS TESTE JUSTE A RELIRE DEPUIS LES RESSOURCES POUR COMPARER LE TIRAGE
' ON RECUPERE LES IMAGES DEPUIS LE FICHIER RESSOURCES
Dim sourcebmp As Bitmap
For imageparcourue As Byte = 0 To 36
sourcebmp = My.Resources.ResourceManager.GetObject("_" & imageparcourue.ToString)
'ON AFFECTE L'IMAGE A COMPARER DANS LES RESSOURCES DANS LA PROPRIETE DU PICTUREBOX ORIGINE
' RECUPERE LES TABLEAUX DE BYTE REPRESENTANT LES IMAGES AFIN DE FAIRE UN hash POUR COMPARAISON
Dim byte1 = ImageToBytes(tirage)
Dim byte2 = ImageToBytes(sourcebmp)
Dim shaM = New SHA256Managed()
Dim hash1 = shaM.ComputeHash(byte1)
Dim hash2 = shaM.ComputeHash(byte2)
For i As Byte = 0 To 31
If hash1(i) <> hash2(i) Then
trouvenumero = False
Exit For
Else ' image trouvée
trouvenumero = True
End If
Next
If trouvenumero = True Then
' ICI ON INCREMENTE NOTRE TOUR ROULETTE
gTourRoulette += 1
Label6.Text = gTourRoulette.ToString
' ICI ON A NOTRE NUMERO SORTI !
Label2.Text = imageparcourue
Tnumeroroulette_I(gTourRoulette).nombre = imageparcourue
' gHistoChange = False
Exit Sub
Else
Label2.Text = ""
' gHistoChange = False
End If
Next 'IMAGEPARCOURUE
End Sub
* je travaille sur vb express 2010
je vous donne mon adresse email peut etre util à implalter ce code : vang_khemarak@orange.fr .
merci de votre aide
A voir également:
COMPARER LES 2 IMAGES AFIN D'EN CONAITRE LA VALEUR NUMERIQUE
NHenry
Messages postés15090Date d'inscriptionvendredi 14 mars 2003StatutModérateurDernière intervention 6 novembre 2023159 21 sept. 2011 à 12:11
Bonjour,
Quand tu postes un code, regardes le point 2 de ma signature.
Reformules ta questions stp, je peine à la comprendre.
---------------------------------------------------------------------
[list=ordered][*]Pour poser correctement une question et optimiser vos chances d'obtenir des réponses, pensez à lire le règlement CS et aussi ce lien[*]Quand vous postez un code, merci d'utiliser la coloration syntaxique (3ième icône en partant de la droite : )
[*]Si votre problème est résolu (et uniquement si c'est le cas), pensez à mettre "Réponse acceptée" sur le ou les messages qui vous ont aidés./list ---
Mon site