Graphic Converter for LED POV Displays.
Moderators: Chuckt, Garth, bitfogav
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Graphic Converter for LED POV Displays.
Hi everyone,
I have been working with VB.NET for a few weeks now and have been learning alot.
To coincide with an instructable I am planning on uploading of the one chip 8x85 POV display I have been programming a graphic converter in VB.NET which will allow you to draw or import your own pictures, which will then convert it to the required hex data to be sent to the microcontroller. It will also show you what the image will look like on the spinning display by also converting it to large LED like pixels.
It is in it's early stages at the moment but it allows you to import a picture and it will then convert it to what it will look like on the display.
Plenty more functionality still to come
(NOTE - The image is 8x85 pixels and is zoomed right in, thats why it is blurry.)
I have been working with VB.NET for a few weeks now and have been learning alot.
To coincide with an instructable I am planning on uploading of the one chip 8x85 POV display I have been programming a graphic converter in VB.NET which will allow you to draw or import your own pictures, which will then convert it to the required hex data to be sent to the microcontroller. It will also show you what the image will look like on the spinning display by also converting it to large LED like pixels.
It is in it's early stages at the moment but it allows you to import a picture and it will then convert it to what it will look like on the display.
Plenty more functionality still to come
(NOTE - The image is 8x85 pixels and is zoomed right in, thats why it is blurry.)
-
- decided to stick around...
- Posts: 30
- Joined: Sun Jul 04, 2010 10:44 am
- Location: Australia
- Contact:
Re: Graphic Converter for LED POV Displays.
Looks great Brad!
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Thanks Mitchy!
Re: Graphic Converter for LED POV Displays.
Is this for your POV Brad? did you ever get the new version finished in the end?
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
I did get the project finished but I didnt document it. So I am doing it all again and taking photos along the way.
This piece of software allows you to either draw your own picture or import one and then convert into the individual pixel data.
I am still working on it but have to thankyou because I have used some of your code from your drawing program
This piece of software allows you to either draw your own picture or import one and then convert into the individual pixel data.
I am still working on it but have to thankyou because I have used some of your code from your drawing program
Re: Graphic Converter for LED POV Displays.
Im glad that you found some of my code useful Brad, and look forward to seeing the new POV project documentedbrad wrote:I am still working on it but have to thankyou because I have used some of your code from your drawing program
Just incase anyone is wondering which drawing program Brad is relating to here is a link:
viewtopic.php?f=26&t=332
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
The best darn computer paint program there is!bitfogav wrote:
Just incase anyone is wondering which drawing program Brad is relating to here is a link:
viewtopic.php?f=26&t=332
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Hi Brad,
I've been breaking my head with vb of late. But I still haven't managed to prepare the software. I managed to get a code on the net for scanning an image. I modified it a lil and got rid of the errors that were there. The code was supposed to find rgb values within a certain range and replace them with red color. I removed that replacing part out and tried to display the scanned values in a text box that i put in the form. My main aim is to get values in form of 3-bit binary, like the excel sheet does. So I can then segregate them into rgb.
I tried different methods but I just cant get it right. I tried converting the rgb values to hex and displaying in the textbox, to my surprise the hex values were css hex values (hex triplets). And I could picture the image of google in the values. But that's NOT what i want, how am I supposed to get the 3-bit binary values????? I went to the extent of Comparing the scanned values with a range of values which I got from the net for different colors, but it still didn't work. I tried to scan for the 7 colors but it could only recognize black and white color (although I don't understand where there is black color in the google logo)
This is the code:
Public Class Form1
Dim image1 As Bitmap
Dim ofd As New OpenFileDialog
Dim pb1 As New PictureBox
Private Sub pb1_click(ByVal ByValsenderAsPictureBox, ByVal ByValeAsEventArgs)
ofd.ShowDialog()
image1 = New Bitmap(ofd.FileName, True)
Dim x, y, q As Integer
Dim pixelColor As Color 'Loopthroughtheimagespixels.
' Dim newColor As Color
' Dim array(image1.Height, image1.Width) As Char
Dim r As Long, g As Long, b As Long
Dim l As Char, m As Char, n As Char
Dim p As Long
For x = 0 To image1.Width - 1
For y = 0 To image1.Height - 1
pixelColor = image1.GetPixel(x, y)
With pixelColor
'If .R < 200 And .R > 100 And .G < 200 And .G > 100 And .B < 200 And .B > 100 Then
r = Val(.R) ' newColor = Color.FromArgb(255, 0, 0)
g = Val(.G) ' image1.SetPixel(x, y, newColor)
b = Val(.B)
'If r < 100 And r > 9 Then
' r = 0 & r
'ElseIf r < 10 Then
' r = 0 & r
'End If
'If g < 100 And g > 9 Then
' g = 0 & g
'ElseIf g < 10 Then
' g = 0 & g
'End If
'If b < 100 And b > 9 Then
' b = 0 & b
'ElseIf b < 10 Then
' b = 0 & b
'End If
'If r = 255 Or r = 238 Or r = 221 Or r = 204 Or r = 187 Or r = 170 Or r = 153 Or r = 136 Or r = 119 Or r = 102 Or r = 85 Or r = 68 Then
' l = 1
'Else
' l = 0
'End If
'If g = 255 Or g = 238 Or g = 221 Or g = 204 Or g = 187 Or g = 170 Or g = 153 Or g = 136 Or g = 119 Or g = 102 Or g = 85 Or g = 68 Then
' m = 0
'Else
' m = 1
'End If
'If b = 255 Or b = 238 Or b = 221 Or b = 204 Or b = 187 Or b = 170 Or b = 153 Or b = 136 Or b = 119 Or b = 102 Or b = 85 Or b = 68 Then
' n = 0
'Else
' n = 1
'End If
'array(x, y) = l & m & n
l = Hex(r)
m = Hex(g)
n = Hex(b)
p = r & g & b
If (p = 0 Or p = 333 Or p = 555 Or p = 888 Or p = 101010 Or p = 131313 Or p = 151515 Or p = 181818 Or p = 202020 Or p = 232323 Or p = 262626 Or p = 282828 Or p = 313131 Or p = 333333 Or p = 343434 Or p = 363636 Or p = 383838 Or p = 414141 Or p = 434343 Or p = 464646 Or p = 484848 Or p = 515151 Or p = 545454 Or p = 565656 Or p = 595959 Or p = 616161 Or p = 646464 Or p = 666666 Or p = 696969 Or p = 717171 Or p = 747474 Or p = 777777 Or p = 797979 Or p = 828282 Or p = 848484 Or p = 858585 Or p = 878787 Or p = 888888 Or p = 898989 Or p = 929292 Or p = 949494 Or p = 979797 Or p = 999999 Or p = 102102102 Or p = 105105105 Or p = 107107107 Or p = 110110110 Or p = 112112112 Or p = 115115115 Or p = 117117117 Or p = 119119119 Or p = 120120120 Or p = 122122122 Or p = 125125125 Or p = 127127127 Or p = 130130130 Or p = 133133133 Or p = 135135135 Or p = 136136136 Or p = 138138138 Or p = 140140140 Or p = 143143143 Or p = 145145145 Or p = 148148148 Or p = 150150150 Or p = 153153153 Or p = 156156156 Or p = 158158158 Or p = 161161161 Or p = 163163163 Or p = 166166166 Or p = 168168168 Or p = 171171171 Or p = 173173173 Or p = 176176176 Or p = 179179179 Or p = 181181181 Or p = 184184184 Or p = 186186186 Or p = 187187187 Or p = 189189189) Then
q = 0 'black
ElseIf (p = 13843226 Or p = 95159159 Or p = 95158160 Or p = 152245255 Or p = 142229238 Or p = 122197205 Or p = 83134139 Or p = 6666111 Or p = 100149237 Or p = 7261139 Or p = 206209 Or p = 191255 Or p = 178238 Or p = 154205 Or p = 104139 Or p = 30144255 Or p = 28134238 Or p = 24116205 Or p = 1678139 Or p = 135206250 Or p = 132112255 Or p = 205 Or p = 123104238 Or p = 72209204 Or p = 2525112 Or p = 128 Or p = 65105225 Or p = 72118255 Or p = 67110238 Or p = 5895205 Or p = 3964139 Or p = 34102 Or p = 135206235 Or p = 126192238 Or p = 108166205 Or p = 10690205 Or p = 131111255 Or p = 122103238 Or p = 10589205 Or p = 7160139 Or p = 70130180 Or p = 99184255 Or p = 92172238 Or p = 79148205 Or p = 54100139 Or p = 51102153 Or p = 51153204 Or p = 102153204 Or p = 127255212 Or p = 118238198 Or p = 102205170 Or p = 69139116 Or p = 255 Or p = 238 Or p = 205 Or p = 139 Or p = 128 Or p = 3624130 Or p = 3535142 Or p = 7777255 Or p = 156 Or p = 8989171 Or p = 50153204 Or p = 127255 Or p = 56176222 Or p = 3180200 Or p = 6586197) Then
q = 1 'blue
ElseIf (p = 15320450 Or p = 477947 Or p = 1000 Or p = 3413934 Or p = 17325547 Or p = 1242520 Or p = 5020550 Or p = 60179113 Or p = 250154 Or p = 10714235 Or p = 19225562 Or p = 17923858 Or p = 15420550 Or p = 10513934 Or p = 152251152 Or p = 154255154 Or p = 144238144 Or p = 124205124 Or p = 8413984 Or p = 4613987 Or p = 84255159 Or p = 78238148 Or p = 67205128 Or p = 255127 Or p = 238118 Or p = 205102 Or p = 13969 Or p = 15420550 Or p = 1272550 Or p = 1182380 Or p = 1022050 Or p = 691390 Or p = 2550 Or p = 1280 Or p = 2380 Or p = 2050 Or p = 1390 Or p = 3514235 Or p = 6611166 Or p = 1272550 Or p = 35142104 Or p = 255127 Or p = 924917 Or p = 2157116) Then
q = 2 'green
ElseIf (p = 255255 Or p = 238238 Or p = 205205205 Or p = 138138138 Or p = 64224208 Or p = 245255 Or p = 229238 Or p = 197205 Or p = 127255212 Or p = 118238198 Or p = 102205170 Or p = 72209204 Or p = 112219219) Then
q = 3 'cyan
ElseIf (p = 12800 Or p = 1783434 Or p = 2554848 Or p = 2384444 Or p = 2053838 Or p = 1392626 Or p = 2045151 Or p = 25500 Or p = 23800 Or p = 20500 Or p = 13900 Or p = 2559971 Or p = 2389266 Or p = 2057957 Or p = 1395438 Or p = 1423535 Or p = 1402323 Or p = 19200) Then
q = 4 'red
ElseIf (p = 255193193 Or p = 238180180 Or p = 240128128 Or p = 250128114 Or p = 25520147 Or p = 23818137 Or p = 20516118 Or p = 255105180 Or p = 255110180 Or p = 238106167 Or p = 20596144 Or p = 1395898 Or p = 1391080 Or p = 19921133 Or p = 2059292 Or p = 255106106 Or p = 2389999 Or p = 2058585 Or p = 255182193 Or p = 255174185 Or p = 238162173 Or p = 205140149 Or p = 13095101 Or p = 219112147 Or p = 255130171 Or p = 238121159 Or p = 205104137 Or p = 1397193 Or p = 20832144 Or p = 25562150 Or p = 23858140 Or p = 20550120 Or p = 1393482 Or p = 25528174 Or p = 22791216) Then
q = 5 'pink
ElseIf (p = 18413411 Or p = 25518515 Or p = 23817314 Or p = 20514912 Or p = 1391018 Or p = 21816532 Or p = 25519337 Or p = 23818034 Or p = 20515529 Or p = 2552550 Or p = 2382380 Or p = 2052050 Or p = 1391390 Or p = 2552150 Or p = 2382010 Or p = 2051730) Then
q = 6 'yellow
ElseIf (p = 209209209 Or p = 212212212 Or p = 214214214 Or p = 217217217 Or p = 219219219 Or p = 221221221 Or p = 222222222 Or p = 224224224 Or p = 227227227 Or p = 229229229 Or p = 232232232 Or p = 235235235 Or p = 237237237 Or p = 238238238 Or p = 240240240 Or p = 242242242 Or p = 245245245 Or p = 247247247 Or p = 250250250 Or p = 252252252 Or p = 255255255) Then
q = 7 'white
Else : TextBox1.AppendText("ERROR ")
End If
'If .R = 0 And .G = 0 Then
TextBox1.AppendText(q & " ")
'End If
'TextBox1.AppendText(l & m & n & " ")
'End If
End With
Next
Next
pb1.Image = image1
End Sub
Private Sub Form1_Load(ByVal ByValsenderAsObject, ByVal ByValeAsEventArgs) Handles Me.Load
Controls.Add(pb1)
pb1.Dock = DockStyle.Fill
AddHandler pb1.Click, AddressOf pb1_click
End Sub
End Class
-------------------------
And when I try to store the values in the array I get an error saying the value exceeds the bounds of the array
Also please explain me the following statements:
Private Sub pb1_click(ByVal ByValsenderAsPictureBox, ByVal ByValeAsEventArgs)
ofd.ShowDialog()
image1 = New Bitmap(ofd.FileName, True)
pb1.Image = image1
Private Sub Form1_Load(ByVal ByValsenderAsObject, ByVal ByValeAsEventArgs) Handles Me.Load
Controls.Add(pb1)
pb1.Dock = DockStyle.Fill
AddHandler pb1.Click, AddressOf pb1_click
End Sub
I've been breaking my head with vb of late. But I still haven't managed to prepare the software. I managed to get a code on the net for scanning an image. I modified it a lil and got rid of the errors that were there. The code was supposed to find rgb values within a certain range and replace them with red color. I removed that replacing part out and tried to display the scanned values in a text box that i put in the form. My main aim is to get values in form of 3-bit binary, like the excel sheet does. So I can then segregate them into rgb.
I tried different methods but I just cant get it right. I tried converting the rgb values to hex and displaying in the textbox, to my surprise the hex values were css hex values (hex triplets). And I could picture the image of google in the values. But that's NOT what i want, how am I supposed to get the 3-bit binary values????? I went to the extent of Comparing the scanned values with a range of values which I got from the net for different colors, but it still didn't work. I tried to scan for the 7 colors but it could only recognize black and white color (although I don't understand where there is black color in the google logo)
This is the code:
Public Class Form1
Dim image1 As Bitmap
Dim ofd As New OpenFileDialog
Dim pb1 As New PictureBox
Private Sub pb1_click(ByVal ByValsenderAsPictureBox, ByVal ByValeAsEventArgs)
ofd.ShowDialog()
image1 = New Bitmap(ofd.FileName, True)
Dim x, y, q As Integer
Dim pixelColor As Color 'Loopthroughtheimagespixels.
' Dim newColor As Color
' Dim array(image1.Height, image1.Width) As Char
Dim r As Long, g As Long, b As Long
Dim l As Char, m As Char, n As Char
Dim p As Long
For x = 0 To image1.Width - 1
For y = 0 To image1.Height - 1
pixelColor = image1.GetPixel(x, y)
With pixelColor
'If .R < 200 And .R > 100 And .G < 200 And .G > 100 And .B < 200 And .B > 100 Then
r = Val(.R) ' newColor = Color.FromArgb(255, 0, 0)
g = Val(.G) ' image1.SetPixel(x, y, newColor)
b = Val(.B)
'If r < 100 And r > 9 Then
' r = 0 & r
'ElseIf r < 10 Then
' r = 0 & r
'End If
'If g < 100 And g > 9 Then
' g = 0 & g
'ElseIf g < 10 Then
' g = 0 & g
'End If
'If b < 100 And b > 9 Then
' b = 0 & b
'ElseIf b < 10 Then
' b = 0 & b
'End If
'If r = 255 Or r = 238 Or r = 221 Or r = 204 Or r = 187 Or r = 170 Or r = 153 Or r = 136 Or r = 119 Or r = 102 Or r = 85 Or r = 68 Then
' l = 1
'Else
' l = 0
'End If
'If g = 255 Or g = 238 Or g = 221 Or g = 204 Or g = 187 Or g = 170 Or g = 153 Or g = 136 Or g = 119 Or g = 102 Or g = 85 Or g = 68 Then
' m = 0
'Else
' m = 1
'End If
'If b = 255 Or b = 238 Or b = 221 Or b = 204 Or b = 187 Or b = 170 Or b = 153 Or b = 136 Or b = 119 Or b = 102 Or b = 85 Or b = 68 Then
' n = 0
'Else
' n = 1
'End If
'array(x, y) = l & m & n
l = Hex(r)
m = Hex(g)
n = Hex(b)
p = r & g & b
If (p = 0 Or p = 333 Or p = 555 Or p = 888 Or p = 101010 Or p = 131313 Or p = 151515 Or p = 181818 Or p = 202020 Or p = 232323 Or p = 262626 Or p = 282828 Or p = 313131 Or p = 333333 Or p = 343434 Or p = 363636 Or p = 383838 Or p = 414141 Or p = 434343 Or p = 464646 Or p = 484848 Or p = 515151 Or p = 545454 Or p = 565656 Or p = 595959 Or p = 616161 Or p = 646464 Or p = 666666 Or p = 696969 Or p = 717171 Or p = 747474 Or p = 777777 Or p = 797979 Or p = 828282 Or p = 848484 Or p = 858585 Or p = 878787 Or p = 888888 Or p = 898989 Or p = 929292 Or p = 949494 Or p = 979797 Or p = 999999 Or p = 102102102 Or p = 105105105 Or p = 107107107 Or p = 110110110 Or p = 112112112 Or p = 115115115 Or p = 117117117 Or p = 119119119 Or p = 120120120 Or p = 122122122 Or p = 125125125 Or p = 127127127 Or p = 130130130 Or p = 133133133 Or p = 135135135 Or p = 136136136 Or p = 138138138 Or p = 140140140 Or p = 143143143 Or p = 145145145 Or p = 148148148 Or p = 150150150 Or p = 153153153 Or p = 156156156 Or p = 158158158 Or p = 161161161 Or p = 163163163 Or p = 166166166 Or p = 168168168 Or p = 171171171 Or p = 173173173 Or p = 176176176 Or p = 179179179 Or p = 181181181 Or p = 184184184 Or p = 186186186 Or p = 187187187 Or p = 189189189) Then
q = 0 'black
ElseIf (p = 13843226 Or p = 95159159 Or p = 95158160 Or p = 152245255 Or p = 142229238 Or p = 122197205 Or p = 83134139 Or p = 6666111 Or p = 100149237 Or p = 7261139 Or p = 206209 Or p = 191255 Or p = 178238 Or p = 154205 Or p = 104139 Or p = 30144255 Or p = 28134238 Or p = 24116205 Or p = 1678139 Or p = 135206250 Or p = 132112255 Or p = 205 Or p = 123104238 Or p = 72209204 Or p = 2525112 Or p = 128 Or p = 65105225 Or p = 72118255 Or p = 67110238 Or p = 5895205 Or p = 3964139 Or p = 34102 Or p = 135206235 Or p = 126192238 Or p = 108166205 Or p = 10690205 Or p = 131111255 Or p = 122103238 Or p = 10589205 Or p = 7160139 Or p = 70130180 Or p = 99184255 Or p = 92172238 Or p = 79148205 Or p = 54100139 Or p = 51102153 Or p = 51153204 Or p = 102153204 Or p = 127255212 Or p = 118238198 Or p = 102205170 Or p = 69139116 Or p = 255 Or p = 238 Or p = 205 Or p = 139 Or p = 128 Or p = 3624130 Or p = 3535142 Or p = 7777255 Or p = 156 Or p = 8989171 Or p = 50153204 Or p = 127255 Or p = 56176222 Or p = 3180200 Or p = 6586197) Then
q = 1 'blue
ElseIf (p = 15320450 Or p = 477947 Or p = 1000 Or p = 3413934 Or p = 17325547 Or p = 1242520 Or p = 5020550 Or p = 60179113 Or p = 250154 Or p = 10714235 Or p = 19225562 Or p = 17923858 Or p = 15420550 Or p = 10513934 Or p = 152251152 Or p = 154255154 Or p = 144238144 Or p = 124205124 Or p = 8413984 Or p = 4613987 Or p = 84255159 Or p = 78238148 Or p = 67205128 Or p = 255127 Or p = 238118 Or p = 205102 Or p = 13969 Or p = 15420550 Or p = 1272550 Or p = 1182380 Or p = 1022050 Or p = 691390 Or p = 2550 Or p = 1280 Or p = 2380 Or p = 2050 Or p = 1390 Or p = 3514235 Or p = 6611166 Or p = 1272550 Or p = 35142104 Or p = 255127 Or p = 924917 Or p = 2157116) Then
q = 2 'green
ElseIf (p = 255255 Or p = 238238 Or p = 205205205 Or p = 138138138 Or p = 64224208 Or p = 245255 Or p = 229238 Or p = 197205 Or p = 127255212 Or p = 118238198 Or p = 102205170 Or p = 72209204 Or p = 112219219) Then
q = 3 'cyan
ElseIf (p = 12800 Or p = 1783434 Or p = 2554848 Or p = 2384444 Or p = 2053838 Or p = 1392626 Or p = 2045151 Or p = 25500 Or p = 23800 Or p = 20500 Or p = 13900 Or p = 2559971 Or p = 2389266 Or p = 2057957 Or p = 1395438 Or p = 1423535 Or p = 1402323 Or p = 19200) Then
q = 4 'red
ElseIf (p = 255193193 Or p = 238180180 Or p = 240128128 Or p = 250128114 Or p = 25520147 Or p = 23818137 Or p = 20516118 Or p = 255105180 Or p = 255110180 Or p = 238106167 Or p = 20596144 Or p = 1395898 Or p = 1391080 Or p = 19921133 Or p = 2059292 Or p = 255106106 Or p = 2389999 Or p = 2058585 Or p = 255182193 Or p = 255174185 Or p = 238162173 Or p = 205140149 Or p = 13095101 Or p = 219112147 Or p = 255130171 Or p = 238121159 Or p = 205104137 Or p = 1397193 Or p = 20832144 Or p = 25562150 Or p = 23858140 Or p = 20550120 Or p = 1393482 Or p = 25528174 Or p = 22791216) Then
q = 5 'pink
ElseIf (p = 18413411 Or p = 25518515 Or p = 23817314 Or p = 20514912 Or p = 1391018 Or p = 21816532 Or p = 25519337 Or p = 23818034 Or p = 20515529 Or p = 2552550 Or p = 2382380 Or p = 2052050 Or p = 1391390 Or p = 2552150 Or p = 2382010 Or p = 2051730) Then
q = 6 'yellow
ElseIf (p = 209209209 Or p = 212212212 Or p = 214214214 Or p = 217217217 Or p = 219219219 Or p = 221221221 Or p = 222222222 Or p = 224224224 Or p = 227227227 Or p = 229229229 Or p = 232232232 Or p = 235235235 Or p = 237237237 Or p = 238238238 Or p = 240240240 Or p = 242242242 Or p = 245245245 Or p = 247247247 Or p = 250250250 Or p = 252252252 Or p = 255255255) Then
q = 7 'white
Else : TextBox1.AppendText("ERROR ")
End If
'If .R = 0 And .G = 0 Then
TextBox1.AppendText(q & " ")
'End If
'TextBox1.AppendText(l & m & n & " ")
'End If
End With
Next
Next
pb1.Image = image1
End Sub
Private Sub Form1_Load(ByVal ByValsenderAsObject, ByVal ByValeAsEventArgs) Handles Me.Load
Controls.Add(pb1)
pb1.Dock = DockStyle.Fill
AddHandler pb1.Click, AddressOf pb1_click
End Sub
End Class
-------------------------
And when I try to store the values in the array I get an error saying the value exceeds the bounds of the array
Also please explain me the following statements:
Private Sub pb1_click(ByVal ByValsenderAsPictureBox, ByVal ByValeAsEventArgs)
ofd.ShowDialog()
image1 = New Bitmap(ofd.FileName, True)
pb1.Image = image1
Private Sub Form1_Load(ByVal ByValsenderAsObject, ByVal ByValeAsEventArgs) Handles Me.Load
Controls.Add(pb1)
pb1.Dock = DockStyle.Fill
AddHandler pb1.Click, AddressOf pb1_click
End Sub
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
And does the function getpixel() work only for bitmap images or something???
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Brad, can u post your code for your converter software so I can get some more ideas??
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Sorry for the late reply.
This is the main piece of code that you are looking for. This will take care on one indivual pixel. It grabs the RGB values and then seperates the data into three decimal numbers (one for red, one for green and one for blue)
I then check to see if the value is greater than or less than a certain intensity. you can just change intensity to 128 (which is halfway between max and min values)
This is the main piece of code that you are looking for. This will take care on one indivual pixel. It grabs the RGB values and then seperates the data into three decimal numbers (one for red, one for green and one for blue)
I then check to see if the value is greater than or less than a certain intensity. you can just change intensity to 128 (which is halfway between max and min values)
Code: Select all
PixelColor = TempBitmap.GetPixel(y, x)
Dim s As String = PixelColor.ToString
s = s.Trim("Color []".ToCharArray)
Dim str() As String = s.Split(","c)
RedData = str(1)
GreenData = str(2)
BlueData = str(3)
RedData = RedData.Trim(" R=".ToCharArray)
GreenData = GreenData.Trim(" G=".ToCharArray)
BlueData = BlueData.Trim(" B=".ToCharArray)
If RedData < Intensity And GreenData < Intensity And BlueData < Intensity Then
PaintColor = Color.Black
ElseIf RedData < Intensity And GreenData < Intensity And BlueData > Intensity Then
PaintColor = Color.Blue
ElseIf RedData < Intensity And GreenData > Intensity And BlueData < Intensity Then
PaintColor = Color.Green
ElseIf RedData < Intensity And GreenData > Intensity And BlueData > Intensity Then
PaintColor = Color.Cyan
ElseIf RedData > Intensity And GreenData < Intensity And BlueData < Intensity Then
PaintColor = Color.Red
ElseIf RedData > Intensity And GreenData < Intensity And BlueData > Intensity Then
PaintColor = Color.Magenta
ElseIf RedData > Intensity And GreenData > Intensity And BlueData < Intensity Then
PaintColor = Color.Orange
ElseIf RedData > Intensity And GreenData > Intensity And BlueData > Intensity Then
PaintColor = Color.White
End If
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Brad,
I'm trying to store the scanned color as values from 0-7 like in your excel spreadsheet. Now these values i have stored in an array of size 300x300 (large array just to be on the safer side so I have enough space to store data). I was then displaying the contents of the array in a textbox and then copying the data into a notepad file then importing the data from the notepad file into excel, which is pretty much tedious.
So I thought of writing the data directly to an excel file, that would make it less work for me. So I started trying to create an excel file and write to it. I found a code on the net that would write data from 2 textboxes to the excel file sheet1 in cell nos 1,1 and 1,2. I modified the code a lil bit - tried to create an array, fill data in that array and then display the contents of the array in the excel file. Everything works fine until the point where the array content has to be written to the excel file. I get an error saying "COMException was Unhandeled - Exception from HRESULT: 0x800A03EC"
The code is as follows:
I'm trying to store the scanned color as values from 0-7 like in your excel spreadsheet. Now these values i have stored in an array of size 300x300 (large array just to be on the safer side so I have enough space to store data). I was then displaying the contents of the array in a textbox and then copying the data into a notepad file then importing the data from the notepad file into excel, which is pretty much tedious.
So I thought of writing the data directly to an excel file, that would make it less work for me. So I started trying to create an excel file and write to it. I found a code on the net that would write data from 2 textboxes to the excel file sheet1 in cell nos 1,1 and 1,2. I modified the code a lil bit - tried to create an array, fill data in that array and then display the contents of the array in the excel file. Everything works fine until the point where the array content has to be written to the excel file. I get an error saying "COMException was Unhandeled - Exception from HRESULT: 0x800A03EC"
The code is as follows:
Code: Select all
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Dim APP As Excel.Application
Dim worksheet As Excel.Worksheet
Dim workbook As Excel.Workbook
Dim misValue As Object = System.Reflection.Missing.Value
Dim code(10, 10) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
APP = New Excel.Application
workbook = APP.Workbooks.Add(misvalue)
'Open("C:\Users\xx\Documents\Visual Studio 2010\Projects\CreateExcelTest\CreateExcelTest\file.xlsx")
worksheet = workbook.Worksheets("sheet1")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim u As Integer = 0
For x As Integer = 0 To 9
For y As Integer = 0 To 9
code(x, y) = u
u += 1
Next
Next
For x As Integer = 0 To 9
For y As Integer = 0 To 9
worksheet.Cells(x, y) = code(x, y)'______________________THIS IS WHERE THE ERROR COMES
Next
Next
'worksheet.Cells(1, 1).Value = TextBox1.Text \
' } THIS WAS THE ORIGINAL PART WHICH WORKED FINE
'worksheet.Cells(1, 2).Value = TextBox2.Text /
End Sub
Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
workbook.SaveAs("C:\Users\xx\Documents\Visual Studio 2010\Projects\CreateExcelTest\CreateExcelTest\file.xlsx")
workbook.Close()
App.Quit()
End Sub
End Class
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Oh and about the conversion, I tried comparing the scanned values with a set of values (I got these values from the net and from the scanned image itself - I tested for google image and I knew which color goes where so I got the codes for the different colors) in my program and the google image gave quite a good resemblance, NOT PERFECT but QUITE GOOD.
I also tested it with your method of comparing the intensities. For 128 I got a lot of black color(OFF LEDS), for 100 the black color became less but I started getting cyan in blue also and also the 'O's were not getting fully detected, neither was the ''g'. So I thought I'd stick to my method although its a lot more tedious to prepare(because I have to keep on adding more and more color combinations for comparison - that's like for example training a voice recognition system, the more you train the more words it knows. OK forgive me I couldn't think of a better example). So now I'm getting the different colors for values form 000-FFF and segregating them into the 8 colors(black,blue,green,cyan,red,pink,yellow,white). Then hopefully I'l get good results for any given picture.
I also tested it with your method of comparing the intensities. For 128 I got a lot of black color(OFF LEDS), for 100 the black color became less but I started getting cyan in blue also and also the 'O's were not getting fully detected, neither was the ''g'. So I thought I'd stick to my method although its a lot more tedious to prepare(because I have to keep on adding more and more color combinations for comparison - that's like for example training a voice recognition system, the more you train the more words it knows. OK forgive me I couldn't think of a better example). So now I'm getting the different colors for values form 000-FFF and segregating them into the 8 colors(black,blue,green,cyan,red,pink,yellow,white). Then hopefully I'l get good results for any given picture.
-
- decided to stick around...
- Posts: 39
- Joined: Mon Apr 25, 2011 6:33 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
Hey Brad,
I solved the Excel sheet problem. I was starting the write operation at row 0 (which does not exist) in excel.
So the following code,
becomes,
What a silly mistake. How dumb can I get.... LOL
I solved the Excel sheet problem. I was starting the write operation at row 0 (which does not exist) in excel.
So the following code,
Code: Select all
For x As Integer = 0 To 9
For y As Integer = 0 To 9
worksheet.Cells(x, y) = code(x, y)
Next
Next
Code: Select all
For x As Integer = 1 To 10
For y As Integer = 1 To 10
worksheet.Cells(x, y) = code(x - 1, y - 1)
Next
Next
What a silly mistake. How dumb can I get.... LOL
- brad
- Site Admin
- Posts: 2578
- Joined: Fri Mar 26, 2010 10:30 pm [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Re: Graphic Converter for LED POV Displays.
You have fixed the problem even before I read the question! good job
I have run into that trap before, where you start from 0 but the software actually starts from 1. If it is looking for something that doesn't exist then you get an error just like what you got!
I have run into that trap before, where you start from 0 but the software actually starts from 1. If it is looking for something that doesn't exist then you get an error just like what you got!
Who is online
Users browsing this forum: No registered users and 5 guests