Color Recognition Project:



Aim of this project
Speaking color reorganized project. Its recognize color from any unique color picture.
Main Title: Color Recognition
Project: Color recognition from a unique color picture.
Developer: Md. Redwanur Rahman
Location: Dhaka, Bangladesh.
Date: 5 November, 2007
I am here to share idea with other.

This snippet of code will change the background color of a picture box to reflect the value of the Red, Green and Blue scroll bars and indicated what the color it is: A shade of blue, purple, orange etc.

This code is fairly accurate but right now isn’t able to distinguish brown/tan colors. This code is still in its infancy.

Program Details
Start Here…………………………………
Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdGo_Click()
'now find out what type of color it is. IE yellow, orange, blue, grey etc...
Dim MyRVal As String
Dim MyGVal As String
Dim MyBVal As String
MyRVal = Brightness(Me.ScrollRed.Value) & "R"
MyGVal = Brightness(Me.ScrollGreen.Value) & "G"
MyBVal = Brightness(Me.ScrollBlue.Value) & "B"
Dim MyWholeColor As String
MyWholeColor = MyRVal & MyGVal & MyBVal
Dim colorname As String
Select Case MyWholeColor
'example: a Dark Red and a Dk Green and a Dark Blue values are similar in color to a dk grey or blk.
Case Is = "DRDGDB"
colorname = "Dk Grey or black"
Case Is = "DRDGMB"
colorname = "Blue"
Case Is = "DRDGLB"
colorname = "Blue"
Case Is = "DRMGDB"
colorname = "Green"
Case Is = "DRMGMB"
colorname = "BlueGreen"
Case Is = "DRMGLB"
colorname = "Blue"
Case Is = "DRLGDB"
colorname = "Green"
Case Is = "DRLGMB"
colorname = "BlueGreen"
Case Is = "DRLGLB"
colorname = "Blue"
Case Is = "MRDGDB"
colorname = "Red"
Case Is = "MRDGMB"
colorname = "Purple"
Case Is = "MRDGLB"
colorname = "Purple"
Case Is = "MRMGDB"
colorname = "Yellow"
Case Is = "MRMGMB"
colorname = "Grey"
Case Is = "MRMGLB"
colorname = "BluePurple"
Case Is = "MRLGDB"
colorname = "Green"
Case Is = "MRLGMB"
colorname = "Green"
Case Is = "MRLGLB"
colorname = "BlueGreen"
Case Is = "LRDGDB"
colorname = "Red"
Case Is = "LRDGMB"
colorname = "RedPurple"
Case Is = "LRDGLB"
colorname = "Purple"
Case Is = "LRMGDB"
colorname = "Orange"
Case Is = "LRMGMB"
colorname = "Pink/Red"
Case Is = "LRMGLB"
colorname = "Purple"
Case Is = "LRLGDB"
colorname = "Yellow"
Case Is = "LRLGMB"
colorname = "Yellow"
Case Is = "LRLGLB"
colorname = "White/Grey"
End Select
TextToSpeech1.Speak ("The color in the picture is " & colorname)
MsgBox ("The color in the picture is " & colorname)
End Sub

Private Sub ScrollBlue_Change()
'change the caption and the back color of the picture
Me.lblblue.Caption = Me.ScrollBlue.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub

Private Sub ScrollGreen_Change()
'change the caption and the back color of the picture
Me.lblGreen.Caption = Me.ScrollGreen.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub

Private Sub ScrollRed_Change()
'change the caption and the back color of the picture
Me.lblRed.Caption = Me.ScrollRed.Value
Call ChangeBackColor(Me.ScrollRed, Me.ScrollGreen, Me.ScrollBlue)
End Sub

Private Sub ChangeBackColor(RVal As Integer, GVal As Integer, BVal As Integer)
'change the back color of the picture to reflect the croll bar values
RVal = Me.ScrollRed.Value
GVal = Me.ScrollGreen.Value
BVal = Me.ScrollBlue.Value
Me.Picture1.BackColor = RGB(RVal, GVal, BVal)
End Sub

Public Function Brightness(mycolor As Integer) As String
'see what the brightness of the color is: dark, medium or light
'"D" for Dark, "L" for light and "M" for med
'If R value and G value and B Value are all less than 85 then it is a dk color
'so will probably be either black or a dk grey (Example (50,50,50) would be a dk grey)
'Same goes for R,G and B value greater than 170. The closer the 3 values get to 255, the closer the
'color will be to white.
If mycolor < 86 Then
Brightness = "D"
ElseIf mycolor < 171 Then
Brightness = "M"
Else
Brightness = "L"
End If
End Function

End Here..........................

For help email me: redu0007@yahoo.com
Visit www.geocities.com/redu0007

Download this Program

Conclusion
From a unique color picture this program can recognized Color Name.


 

Skilled computer interface hardware & software developer and awarded by national, international universities for developing various projects. Strong background in C, C++ and Visual basic programming.
Want to learn more about interface and Voice recognition Projects.
Visit:

Redwan's Programs
Bangladesh Computer Journal:
Computer Jagat


Bangladeshi Computer Journal:
C News


Bangladeshi Computer Journal:
Computer Tomorrow
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free