Image conversion software

Post here to discuss the One Chip POV Display

Moderators: Chuckt, Garth, bitfogav

Digg
decided to stick around...
decided to stick around...
Posts: 27
Joined: Sun Mar 28, 2010 1:27 pm

Image conversion software

Post by Digg » Tue Jan 22, 2013 12:58 pm

Hi Brad,

Its been a while, I see your page is still active. I was hoping that you could point me in the direction of your code for the image conversion software you made for your pov. I will be making a bike wheel pov and was going to modify the code for a radial pov. Any help would be great.

Thanks in advance,

Digg

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Wed Jan 23, 2013 8:59 pm

Surly you didn't think bradsprojects would be gone!

I would love you to re-code the software for a radial POV, could you please post back here with your progress?

I have attached the VB.NET project for you although it does need a few improvements, for example when spitting out the array data, it gives you decimal places which need to be removed, like this:

Code: Select all

const MyDataRed(8.000) as byte = (%10011101, %10011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111)
const MyDataGreen(8.000) as byte = (%00001010, %00000000, %00011111, %10011111, %11111111, %11111111, %11111111, %11111111)
const MyDataBlue(8.000) as byte = (%10110101, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111)
This will need to be fixed so it gives you:

Code: Select all

const MyDataRed(8) as byte = (%10011101, %10011111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111)
const MyDataGreen(8) as byte = (%00001010, %00000000, %00011111, %10011111, %11111111, %11111111, %11111111, %11111111)
const MyDataBlue(8) as byte = (%10110101, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111)
It's not really commented at all but let me know how you go.
Arduino and Swordfish Graphic Converter.zip
(341.7 KiB) Downloaded 346 times

Digg
decided to stick around...
decided to stick around...
Posts: 27
Joined: Sun Mar 28, 2010 1:27 pm

Re: Image conversion software

Post by Digg » Fri Feb 01, 2013 2:56 pm

Thanks Brad,

Sorry for the late response. I had tried to respond on my iPhone last week but it must not have gone through. It when a little like this:

I would never think that this site would go down but I am glad to know that it is still up with mostly the same people still doing interesting things. I will keep you posted on my work but I will not have much time to do much development for the next few weeks. I am more experienced with C++/C and python do to school but picking up VB again should not prove too hard.

Also wanted to thank you for helping me get my start with micro-controllers and POVs.

Digg
decided to stick around...
decided to stick around...
Posts: 27
Joined: Sun Mar 28, 2010 1:27 pm

Re: Image conversion software

Post by Digg » Fri Feb 01, 2013 3:51 pm

I was looking at the problem you were having but the decimal places are not showing up unless I make it a really big picture.

I think this should "fix" it but i don't have the problem you are talking about sorry.

replace your DoConversion() with this. All I did was add arraySize. Let me know if this works

Code: Select all

    Private Sub DoConversion()
        TextBoxInfo.Text = "Converting Image"
        DataCounter = 0             ' clear the counters that we use when converting
        DataCounter2 = 0            ' clear the counters that we use when converting
        TextBoxRed.Clear()
        TextBoxGreen.Clear()
        TextBoxBlue.Clear()
        TextBoxAllData.Clear()
        Dim Directory As New IO.DirectoryInfo(DirectoryName)
        Dim Files As IO.FileInfo() = Directory.GetFiles("*.*")
        'Dim FileName As IO.FileInfo
        Dim arraySize As Integer
        arraySize = Int(PictureBox1.Height * (PictureBox1.Width / DataType))
        If RadioButtonArduino.Checked Then
            If RadioButtonLongWords.Checked Then
                TextBoxRed.AppendText("const prog_uint32_t " & TextBoxOutputName.Text & "Red" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxGreen.AppendText("const prog_uint32_t " & TextBoxOutputName.Text & "Green" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxBlue.AppendText("const prog_uint32_t " & TextBoxOutputName.Text & "Blue" & "[" & arraySize & "]PROGMEM={0b")
            ElseIf RadioButtonWords.Checked Then
                TextBoxRed.AppendText("const prog_uint16_t " & TextBoxOutputName.Text & "Red" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxGreen.AppendText("const prog_uint16_t " & TextBoxOutputName.Text & "Green" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxBlue.AppendText("const prog_uint16_t " & TextBoxOutputName.Text & "Blue" & "[" & arraySize & "]PROGMEM={0b")
            ElseIf RadioButtonBytes.Checked Then
                TextBoxRed.AppendText("const prog_uint8_t " & TextBoxOutputName.Text & "Red" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxGreen.AppendText("const prog_uint8_t " & TextBoxOutputName.Text & "Green" & "[" & arraySize & "]PROGMEM={0b")
                TextBoxBlue.AppendText("const prog_uint8_t " & TextBoxOutputName.Text & "Blue" & "[" & arraySize & "]PROGMEM={0b")
            End If
        End If
        If RadioButtonSwordfish.Checked Then
            If RadioButtonLongWords.Checked Then
                TextBoxRed.AppendText("const " & TextBoxOutputName.Text & "Red" & "(" & arraySize & ") as longword = (%")
                TextBoxGreen.AppendText("const " & TextBoxOutputName.Text & "Green" & "(" & arraySize & ") as longword = (%")
                TextBoxBlue.AppendText("const " & TextBoxOutputName.Text & "Blue" & "(" & arraySize & ") as longword = (%")
            ElseIf RadioButtonWords.Checked Then
                TextBoxRed.AppendText("const " & TextBoxOutputName.Text & "Red" & "(" & arraySize & ") as word = (%")
                TextBoxGreen.AppendText("const " & TextBoxOutputName.Text & "Green" & "(" & arraySize & ") as word = (%")
                TextBoxBlue.AppendText("const " & TextBoxOutputName.Text & "Blue" & "(" & arraySize & ") as word = (%")
            ElseIf RadioButtonBytes.Checked Then
                TextBoxRed.AppendText("const " & TextBoxOutputName.Text & "Red" & "(" & arraySize & ") as byte = (%")
                TextBoxGreen.AppendText("const " & TextBoxOutputName.Text & "Green" & "(" & arraySize & ") as byte = (%")
                TextBoxBlue.AppendText("const " & TextBoxOutputName.Text & "Blue" & "(" & arraySize & ") as byte = (%")
            End If
        End If
        ConvertImage()
        If OutputRed.Checked = True Then
            TextBoxAllData.AppendText(TextBoxRed.Text & vbCrLf)
        End If
        If OutputGreen.Checked = True Then
            TextBoxAllData.AppendText(TextBoxGreen.Text & vbCrLf)
        End If
        If OutputBlue.Checked = True Then
            TextBoxAllData.AppendText(TextBoxBlue.Text)
        End If
        TextBoxAllData.SelectAll()
        TextBoxAllData.Copy()
        TextBoxInfo.Text = "Data Copied To Clipboard"
        MsgBox("Data Has Been Copied To The Clipboard")
    End Sub

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Fri Feb 01, 2013 9:14 pm

Thanks for the code Digg, but I think I know the problem. I declared the variables as decimal instead of integers! My mistake :)

Digg
decided to stick around...
decided to stick around...
Posts: 27
Joined: Sun Mar 28, 2010 1:27 pm

Re: Image conversion software

Post by Digg » Tue Feb 05, 2013 5:53 am

That is your problem, but as a quick fix to it I just did the calculation and put it into an integer so that I did not have to go find all the variables. It will also run slightly faster this way as it will not have to do the math each time. I doubt you could tell the difference in speed though.

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Tue Feb 05, 2013 7:53 pm

Glad it works for you :)

How is your version coming along?

ORB11
semi-newbie
semi-newbie
Posts: 12
Joined: Wed Jul 02, 2014 7:30 am

Re: Image conversion software

Post by ORB11 » Wed Jul 02, 2014 10:40 am

hello Brad,

I'm doing some testing with this program (Arduino and Swordfish Graphic Converter), but when I convert the image it returns a wrong value in the corresponding binary.

When I use your program (POV GRAPHIC CONVERTER) the corresponding binary value the image is correct and works fine in POV Project.

I checked everything and can not find the problem.

What could be different between the two codes? Please help me troubleshoot the problem. :(

Sorry for bad english. :wink:

thank you in advance


  Follow converted images below:

correct image

const GreenData(16) as byte = (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00111000,%00111000,%00111000,%00000000,%00000000)


same image with error

const MyDataGreen(16) as byte =
(%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000, %00000000,%00011100,%00011100,%00011100,%00000000,%00000000,%00000000)

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Wed Jul 02, 2014 10:45 pm

Hi ORB11,

I am pretty sure with the swordfish and Arduino version you can choose to scan the image from top to bottom or front left to right (or something to that effect). If your image is not being drawn correctly when using that version then I would try selecting the other drawing option and see if that works for you.

I.E. if you were trying top to bottom and it wasn't working, then you should try left to right and vice versa.

One obvious thing to note though is that in your code you posted, the arrays are called different things.

ORB11
semi-newbie
semi-newbie
Posts: 12
Joined: Wed Jul 02, 2014 7:30 am

Re: Image conversion software

Post by ORB11 » Thu Jul 03, 2014 1:15 pm

hi Brad,

Thanks for the quick feedback.

I'm trying to develop a conversion program for course completion,
but I'm encountering this problem in converting the image to binary.

Could you provide me the changes you made in your program to work properly ? :oops:

Thank you.

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Thu Jul 03, 2014 9:15 pm

Could you provide me the changes you made in your program to work properly ?
I'm not sure exactly what you mean by that?

Where did you download the Arduino and Swordfish Graphic Converter from? because I am pretty sure I have only ever made one version of it.

ORB11
semi-newbie
semi-newbie
Posts: 12
Joined: Wed Jul 02, 2014 7:30 am

Re: Image conversion software

Post by ORB11 » Fri Jul 04, 2014 8:43 am

Hi Brad,

Sorry not explaining myself very well, I'm trying to use this code you attached earlier in this topic (Arduino and Swordfish Graphic Converter.zip), but when I convert an image with this, the binary data do not match the correct data! You could do a test with the version that is available here earlier this Topic to confirm that the image conversion is equal to your new project (PovConverterBigGraphics POV one PIC RGB)?

Falt image

Arduino and Swordfish Graphic Converter.ZIP this Topic


const MyDataRed(8) as byte =(%00000000,%00000000,%00001000,%00000000,%00000000,%00000000,%00000000,%00000000)

const MyDataGreen(8) as byte =(%00000000,%00000000,%00000000,%00000000,%00001000,%00000000,%00000000,%00000000)

const MyDataBlue(8) as byte =(%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00001000,%00000000)



'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

correct image

POV one chip (viewtopic.php?f=17&t=344 )



const RedData(8) as byte =(%00000000,%00000000,%00000000,%00000000,%00100000,%00000000,%00000000,%00000000)

const GreenData(8) as byte =(%00000000,%00000000,%00000000,%00000000,%00001000,%00000000,%00000000,%00000000)

const BlueData(8) as byte =(%00000000,%00000000,%00000000,%00000000,%00000010,%00000000,%00000000,%00000000)


NOTE: The same image 8 x 8 have different binary conversion! Why?? :shock:

Thanks Brad
Last edited by ORB11 on Fri Aug 15, 2014 8:10 am, edited 1 time in total.

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Fri Jul 04, 2014 12:32 pm

Okay, for some reason I thought you had downloaded a different version.

Try this one and let me know how you go :)
ArduinoAndSwordfishGraphicConverter.zip
(350.93 KiB) Downloaded 199 times

ORB11
semi-newbie
semi-newbie
Posts: 12
Joined: Wed Jul 02, 2014 7:30 am

Re: Image conversion software

Post by ORB11 » Mon Jul 07, 2014 7:24 am

hi Brad,

Thanks for the quick feedback.

I did several tests with the new project and when I enable the Left to Right option the image are OK! :) but when I enable the option Top to Bottom image is not OK! :(

I tried to make some changes, such as invert the function (For) of X with Y but the most we got was OK to have the image with only 8 Height value.

What can be wrong in the function Top to Bottom? :?

Thanks Brad

User avatar
brad
Site Admin
Site Admin
Posts: 2576
Joined: Fri Mar 26, 2010 10:30 pm

Re: Image conversion software

Post by brad » Tue Jul 08, 2014 11:01 am

It all depends on how your image is drawn. This will determine whether you should scan the image left to right or if you should scan it top to bottom.

Could you please post your image here so I can see what it should look like?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest