none
Pixelating an image? RRS feed

  • Question

  • What is the best way to pixelate an image in the imagelist? Is there an extension for it?

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, September 29, 2014 8:48 PM
    Answerer

Answers

  • Looks like it doesn't work at all on W8 - will fix wth another method somehow - but I just uploadedthe pixelate option - enjoy.
    Tuesday, September 30, 2014 5:43 PM
    Moderator

All replies

  • Have a look at LDImage.EffectBlocks - there are some other LDImage effects as well, if these are not exactly what you want then the extension code could be modified.

    LDImage.EffectBlocks is a sort of pixelate in that it shrinks the image by an input factor then expands it back (loses resolution, blurs it).

    GraphicsWindow.Width = 400
    GraphicsWindow.Height = 200
    LDUtilities.FixFlickr()
    img = ImageList.LoadImage(Flickr.GetPictureOfMoment())
    GraphicsWindow.DrawResizedImage(img,0,0,200,200)
    LDImage.EffectBlocks(img,10)
    GraphicsWindow.DrawResizedImage(img,200,0,200,200)

    I guess a true pixelate would be a bit different but it depends what it is used for.

    EDIT will add a pixelate (LDImage.EffectPixelate) to next release, like this:

    Monday, September 29, 2014 9:06 PM
    Moderator
  • So i'm trying to make that motion detector again :D

    I just thought if I Pixelated it, I have to check less pixles.

    I'm thinking something like this: http://www.witandwhistle.com/Blog_Pics/DIY_pixel_painting1.jpg

    Also, LDimages.Mean isn't there any more. is there a reason?

    Thanks!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, September 29, 2014 9:41 PM
    Answerer
  • I think the mean got amalgameted into LDImages.Statistics a while ago.

    The new pixelate method (see edit above) looks close to what you want perhaps, when I upload it.  It will take a parameter that is the number of pixels in x and y to average over - the defaut (my image) will be 16.

    Monday, September 29, 2014 9:49 PM
    Moderator
  • Sweet! Whats the ETA on that?

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, September 29, 2014 9:58 PM
    Answerer
  • Here is a webcam motion detected I wrote, import TZQ388.

    I'm having some issue with webcam on Windows 8 so would like to try fix that, otherwise will upload tomorrow.

    Monday, September 29, 2014 10:09 PM
    Moderator
  • Thats cool! But I what I was hoping to do was locate the center of where the motion was coming from. That way I could Hook it up to me Airsoft RC sentry turret :D

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, September 29, 2014 10:35 PM
    Answerer
  • Are you using windows 8(.1)? does LDWebCam work on it?
    Tuesday, September 30, 2014 8:07 AM
    Moderator
  • Nope. I'm using Win 7

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Tuesday, September 30, 2014 5:31 PM
    Answerer
  • Looks like it doesn't work at all on W8 - will fix wth another method somehow - but I just uploadedthe pixelate option - enjoy.
    Tuesday, September 30, 2014 5:43 PM
    Moderator
  • Works great!! Thanks!

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Wednesday, October 1, 2014 2:08 PM
    Answerer
  • Hey litdev, Could you help me out? I'm at wits end.

    I'm trying to make a auto aiming turret using your webcam software. How I planned to do so is this:

    First I'd take an Image of what the webcam saw, Then Id pixleate it. After that I'd see which pixles were lighter than the rest, locate them and use there position to aim my turret via the Dx7 software you wrote. Buut I can get past the locating the light pixles part :(

    Here is what I have so far:

    Webcam = LDWebCam.Start(400,300)
    GraphicsWindow.Width = 800
    
    img2 = ""
    
    Num_Pix = 4
    
    Array1["F"] = 15
    Array1["E"] = 14
    Array1["D"] = 13
    Array1["C"] = 12
    Array1["B"] = 11
    Array1["A"] = 10
    Array1[9] = 9
    Array1[8] = 8
    Array1[7] = 7
    Array1[6] = 6
    Array1[5] = 5
    Array1[4] = 4
    Array1[3] = 3
    Array1[2] = 2
    Array1[1] = 1
    Array1[0] = 0
    
    Array2[2] = "Red"
    Array2[4] = "Green"
    Array2[6] = "Blue"
    
    
    Timer.Interval = 1000
    Timer.Tick = Check_Movement
    
    GraphicsWindow.MouseDown = MD
    
    While 1 = 1
    Program.Delay(1000)
    ' Check_pos()
    img = Image
    LDImage.EffectPixelate(img,40)
    'Program.Delay(100)
    'LDImage.EffectContrast(img,200)
    'Program.Delay(100)
    'LDImage.Multiply(img,300,300,300)
    'Program.Delay(100)
    
    GraphicsWindow.DrawResizedImage(img,420,20,320,240)
    EndWhile
    
    
    Sub Check_Movement
      img1 = LDWebCam.SnapshotToImageList()
    
    image = LDImage.DifferenceImages(img1,img2)
    
    
    
    
    
          img2 = img1
    
    EndSub
     
     
     Sub Convert_Hex_to_Dec
    Hex[1] = Text.GetSubText(Input,1,1)
    Hex[2] = Text.GetSubText(Input,2,1)
    Output = (Array1[Hex[1]] * 16) + Array1[Hex[2]]
    EndSub
    
    Sub Check_pos
      Checkimg = img
      Largestx = ""
      Largesty = ""
        Largestxpos = ""
      Largestypos = ""
      For x = 1 To 9
        For y = 1 To 7
          Color = LDImage.GetPixel(Checkimg,-36 + (x * 36),-34 +(y * 34))   
        For i = 2 to 6 Step 1 
          Input = Text.GetSubText(Color,i,2)
          Convert_Hex_to_Dec()
         RGBColor[Array2[i]] = Output
       EndFor
       
        Red = RGBColor["Red"]
        Green = RGBColor["Green"]
        Blue = RGBColor["Blue"]
        
        
        Avrg = (Red + Green + Blue) / 3
        TextWindow.WriteLine("Avrg = " + Avrg)
        TextWindow.WriteLine((x/9) * 100 + "% Done")
     If Avrg > Largestx Then
          Largestx = Avrg
          Largestxpos = x
        EndIf
            If Avrg > LargestY Then
          Largesty = Avrg
          Largestypos = y
          EndIf
      EndFor
    EndFor
    
    
        TextWindow.WriteLine("Gone through")
        
        TextWindow.WriteLine(Largestxpos)
        TextWindow.WriteLine(Largestypos)
        
        Shapes.Move(Shapes.AddEllipse(10,10),392 + (Largestxpos * 36),-5 +(Largestypos * 34))
    
    EndSub
    
    Sub MD
      Color = GraphicsWindow.GetPixel(GraphicsWindow.MouseX,GraphicsWindow.MouseY)
          For i = 2 to 6 Step 1 
          Input = Text.GetSubText(Color,i,2)
          Convert_Hex_to_Dec()
         RGBColor[Array2[i]] = Output
       EndFor
       
        Red = RGBColor["Red"]
        Green = RGBColor["Green"]
        Blue = RGBColor["Blue"]
      GraphicsWindow.ShowMessage("Red = " + Red + ", Green = " + Green + ", Blue = " + Blue,"")
      EndSub
    Thanks!!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11


    Thursday, October 2, 2014 3:30 AM
    Answerer
  • First, there are some commands in extension to do some bits:

    • hex conversions (LDMath.Decimal2Base and LDMath.Base2Decimal)
    • get RGB fromcolours (LDColors.GetRed etc)

    And your program - say we want a low res gray scale image - so let's do that or  just get hightness and not bother with RBG and pixelating etc.

    dim = 16
    webCam = LDWebCam.Start(dim,dim)
    GraphicsWindow.Width = (dim+1)*30
    GraphicsWindow.Height = GraphicsWindow.Width
    GraphicsWindow.MouseDown = OnMouseDown
    While ("True")
      Program.Delay(20)
    EndWhile
    
    Sub OnMouseDown
      GraphicsWindow.Clear()
      img = LDWebCam.SnapshotToImageList()
      'LDImage.EffectGray(img) 'Dn't need this if weget Lightness
      For i = 1 To dim
        For j = 1 To dim
          data[i][j] = LDColours.GetLightness(LDImage.GetPixel(img,i-1,j-1))
          GraphicsWindow.DrawText(30*i,30*j,Math.Floor(100*data[i][j]))
        EndFor
      EndFor
      GraphicsWindow.DrawImage(img,10,10)
      LDImage.Remove(img)
    EndSub
      
    maybe thisisn't what you want, but its some ideas...

    Thursday, October 2, 2014 5:40 PM
    Moderator
  • Or perhaps more like this...

    dim = 16
    gw = (dim+1)*30
    GraphicsWindow.Width = gw
    GraphicsWindow.Height = gw
    webCam = LDWebCam.Start(dim,dim)
    Program.Delay(1000) 'Get going
    imgLast = LDWebCam.SnapshotToImageList()
    OnTick()
    GraphicsWindow.MouseDown = OnMouseDown
    Timer.Interval = 1000
    Timer.Tick = OnTick

    Sub OnTick
      LDImage.Remove(imgDiff)
      img = LDWebCam.SnapshotToImageList()
      imgDiff = LDImage.DifferenceImages(img,imgLast)
      LDImage.Remove(imgLast)
      imgLast = img
    EndSub

    Sub OnMouseDown
      Timer.Pause()
      Program.Delay(100)
      GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
      GraphicsWindow.FillRectangle(0,0,gw,gw)
      GraphicsWindow.DrawImage(imgDiff,dim+10,0)
      GraphicsWindow.BrushColor = "Black"
      For i = 1 To dim
        For j = 1 To dim
          data[i][j] = LDColours.GetLightness(LDImage.GetPixel(imgDiff,i-1,j-1))
          GraphicsWindow.DrawText(30*i,30*j,Math.Floor(100*data[i][j]))
        EndFor
      EndFor
      Timer.Resume()
    EndSub

    Thursday, October 2, 2014 5:51 PM
    Moderator
  • Thats brilliant! 

    I modified it a bit to give me an exact coordinate of where the center of movement is. But now it seems to freeze every so often. I can't seem to figure that one out.

    dim = 16
    Sensitivity = 20
    gw = (dim+1)*30
    GraphicsWindow.Width = gw
    GraphicsWindow.Height = gw
    webCam = LDWebCam.Start(dim,dim)
    Program.Delay(1000) 'Get going
    imgLast = LDWebCam.SnapshotToImageList()
    OnTick()
    GraphicsWindow.MouseDown = OnMouseDown
    
    Timer.Interval = 1000
    Timer.Tick = OnTick
    
    Sub OnTick
      LDImage.Remove(imgDiff)
      img = LDWebCam.SnapshotToImageList()
      imgDiff = LDImage.DifferenceImages(img,imgLast)
      LDImage.Remove(imgLast)
      imgLast = img
    EndSub
    
    Sub OnMouseDown
      Timer.Pause()
      Program.Delay(100)
      Xnum = 0
      Ynum = 0
      Xrawavr = 0
      Yrawavr = 0
      GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
      GraphicsWindow.FillRectangle(0,0,gw,gw)
      GraphicsWindow.DrawImage(imgDiff,dim+10,0)
      GraphicsWindow.BrushColor = "Black"
      For x = 1 To dim
        For y = 1 To dim
          data[x][y] = LDColours.GetLightness(LDImage.GetPixel(imgDiff,x-1,y-1))
          GraphicsWindow.DrawText(30*x,30*y,Math.Floor(100*data[x][y]))
          If Math.Floor(100*data[x][y]) > Sensitivity Then
           
            Xnum = Xnum + 1
            Xrawavr = Xrawavr + x
            Ynum = Ynum + 1
            Yrawavr = Yrawavr + y
          EndIf
        EndFor
      EndFor
      XPosAvrg = Xrawavr / Xnum
      YPosAvrg = Yrawavr / Ynum
    
    GraphicsWindow.DrawLine(30*XPosAvrg,0,30*XPosAvrg,GraphicsWindow.Height)
    GraphicsWindow.DrawLine(0,30*YPosAvrg,GraphicsWindow.Width,30*YPosAvrg)
      Timer.Resume()
    EndSub


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Thursday, October 2, 2014 11:06 PM
    Answerer
  • I ran into a really weird problem here.

    For some reason, If I take out the line that prints the numbers onto the GW, the program goes Really slow. Check this out.

    dim = 16
    Sensitivity = 20
    gw = (dim+1)*30
    GraphicsWindow.Width = (gw * 2) + 10
    GraphicsWindow.Height = gw
    webCam = LDWebCam.Start(dim,dim)
    Program.Delay(1000) 'Get going
    imgLast = LDWebCam.SnapshotToImageList()
    OnTick()
    'GraphicsWindow.MouseDown = OnMouseDown
    GraphicsWindow.PenColor = "White"
    'Timer.Interval = 1000
    'Timer.Tick = OnTick
    
    While 1 = 1
      Program.Delay(500)
      OnTick()
    EndWhile
    
    Sub OnTick
      LDImage.Remove(imgDiff)
      img = LDWebCam.SnapshotToImageList()
      imgDiff = LDImage.DifferenceImages(img,imgLast)
      LDImage.Remove(imgLast)
      imgLast = img
      Program.Delay(100)
      Xnum = 0
      Ynum = 0
      Xrawavr = 0
      Yrawavr = 0
      GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
      GraphicsWindow.FillRectangle(0,0,gw,gw)
      GraphicsWindow.DrawResizedImage(imgDiff,10,10,gw - 10,gw - 10)
      GraphicsWindow.DrawResizedImage(img,gw,0,gw - 10,gw - 10)
      
      
      For x = 1 To dim
        For y = 1 To dim
          data[x][y] = LDColours.GetLightness(LDImage.GetPixel(imgDiff,x-1,y-1))
                                                                            '\/ \/ \/ \/ \/ \/ THIS LINE HERE========================
          GraphicsWindow.DrawText(30*x,30*y,Math.Floor(100*data[x][y]))    '<<<<<<<<<<<<<<<<<<<
                                                                            '/\ /\ /\ /\ /\ /\ =========================================
          TextWindow.WriteLine(x)
          If Math.Floor(100*data[x][y]) > Sensitivity Then
            
            Xnum = Xnum + 1
            Xrawavr = Xrawavr + x
            Ynum = Ynum + 1
            Yrawavr = Yrawavr + y
          EndIf
        EndFor
      EndFor
      XPosAvrg = Xrawavr / Xnum
      YPosAvrg = Yrawavr / Ynum
      
      GraphicsWindow.DrawLine(30*XPosAvrg,0,30*XPosAvrg,GraphicsWindow.Height)
      GraphicsWindow.DrawLine(0,30*YPosAvrg,GraphicsWindow.Width,30*YPosAvrg)
    EndSub

    It runs SO much faster if line 41 is there! If you comment it out, It slows WAY down.

    What is going on???


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11



    Friday, October 3, 2014 4:12 AM
    Answerer
  • Strange - I changed PC to Windows8 recently and had to completely redo the webcam a different way and did have some issues with threadingwith issues a bit like yours. 

    I uploaded a modified version late last night, but it still shows your issue.

    It does however include a switch to return to the Windows 7 webcam code which may be better for you until I work out what is up with the new DirectX version.  The switch is LDWebCam.PreWin8Mode = "True".  Untested as my old W7 PC has a new owner.

    I am away from home for the next week so may not make much progress on this for a bit.

    The issue seems to be if you have the TextWindow.WriteLine(x) as well.  If you comment it out it works - so perhaps there is an issue with LDColours.GetLightness(LDImage.GetPixel(imgDiff,x-1,y-1)) if the GraphicsWindow loses focus or something like that?...

    When I save your file somewhere and run t, it works with the GW line commented out - very strange....

    Friday, October 3, 2014 5:19 PM
    Moderator
  • Uploaded another variant that may do better...
    Friday, October 3, 2014 8:39 PM
    Moderator
  • So I did some testing...

    I added:  GraphicsWindow.DrawText(0,0,"Test") Right before the commented out GW line. That made it run faster. But when I changed it to  GraphicsWindow.DrawText(0,0,"") It ran slow again. 

    This is very boggleing to me.


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, October 3, 2014 9:23 PM
    Answerer
  • So I pinpointed the issue.

    I Wrote some code to see how long it took to execute this command: 

    data[x][y] = LDColours.GetLightness(LDImage.GetPixel(imgDiff,x-1,y-1))

    With the graphicswindow text in, It usually took 1 or 2 ms for it to execute, with every 10th one or so taking 250 ms.

    With the GW text code out, It took 1 ms half the time and 250 ms half the time.

    So I hope that gives you some info :D 


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, October 3, 2014 9:31 PM
    Answerer
  • WOW! I just got your latest version and it runs SO FAST! Even whithout the GW Text code! Its great!!

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, October 3, 2014 9:37 PM
    Answerer
  • So the program keeps sporadically freezing. After a little debug work I figured out that it always will freeze when its trying to take a snapshot. I don't know what I could do about this but I thought I'd bring it up.

    Oh yeah. I also have a program delay of 200 right after it. I think that helps.

    Thanks!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Saturday, October 4, 2014 4:57 PM
    Answerer
  • any update on why it would be freezing?

    Thanks!


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, October 6, 2014 6:45 PM
    Answerer
  • So i found out that the delay doesn't help. It just seems like it because the command is run more frequently, and thus crashes the program in a faster time.

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, October 10, 2014 4:07 PM
    Answerer
  • I've uploaded a variant that I can't cause to freeze.  I actually removed some of the code to try handle the threading that may have been the problem?...

    If you have code that still shows proble, then please give it to me as the various ones I have seem OK - but possible threading errors can be hard to repro.

    Sunday, October 12, 2014 5:34 PM
    Moderator
  • So the new .dll won't freeze now, but after a few minuets it throws an exception: 

       at MS.Internal.Parsers.ParseColor(String color, IFormatProvider formatProvider, ITypeDescriptorContext context)
       at System.Windows.Media.ColorConverter.ConvertFromString(String value)
       at LitDev.LDColours.GetRed(Primitive colour)
       at LitDev.LDColours.GetLightness(Primitive colour)
       at _SmallBasicProgram.get_location()
       at _SmallBasicProgram._Main()


    Here is the code:

    dim = 16
    Sensitivity = 10
    gw = 540
    
    GraphicsWindow.Width = (gw * 2) + 10
    GraphicsWindow.Height = gw
    NewImage = Controls.AddButton("Reset image",300,10)
    Controls.ButtonClicked = Bc
    GraphicsWindow.PenColor = "White"
    GraphicsWindow.BrushColor = "White"
    Timer.Interval = 10
    Timer.Tick = Transmitlocation
    
    
    
    webCam = LDWebCam.Start(dim,dim)
    Shapes.Move(webCam,gw,gw)
    Program.Delay(2000) 'Get going
    
    
    
    
    
    For i = 1 to 8
      channel[i] =  0.5
    EndFor
    Program.Delay(200)
    imgstart = LDWebCam.SnapshotToImageList()
    
    
    While 1 = 1
      
      GetImage()
      Get_Location()
      Draw_Lines()
      Get_Output()
    
      
    EndWhile
    
    
    
    '==============================================================================
    '==============================================================================
    '======================SUBROUTINES===========================================
    '==============================================================================
    '==============================================================================
    
    
    Sub GetImage
      LDImage.Remove(imgDiff)
      img = LDWebCam.SnapshotToImageList()
      imgDiff = LDImage.DifferenceImages(img,imgstart)
      GraphicsWindow.DrawResizedImage(imgDiff,10,10,gw - 10,gw - 10)
      GraphicsWindow.DrawResizedImage(img,gw,0,gw - 10,gw - 10)
    EndSub
    
    Sub Get_Location
      Xnum = 0
      Ynum = 0
      Xrawavr = 0
      Yrawavr = 0
      
      For x = 1 To dim 
        For y = 1 To dim 
          data[x][y] = LDColours.GetLightness(LDImage.GetPixel(imgDiff,x-1,y-1))   
          
          If Math.Floor(100*data[x][y]) > Sensitivity Then  
            Xnum = Xnum + 1
            Xrawavr = Xrawavr + x
            Ynum = Ynum + 1
            Yrawavr = Yrawavr + y
          EndIf
          
        EndFor
      EndFor
      XPosAvrg = LDMath.Truncate(Xrawavr / Xnum * 100) / 100
      YPosAvrg = LDMath.Truncate(Yrawavr / Ynum * 100) / 100
    EndSub
    
    Sub Draw_Lines
      GraphicsWindow.DrawLine(30*XPosAvrg,0,30*XPosAvrg,GraphicsWindow.Height)
      GraphicsWindow.DrawLine(0,30*YPosAvrg,GraphicsWindow.Width,30*YPosAvrg)
    EndSub
    
    Sub Get_Output
      status = "Channels"
      For i = 1 To 8
        If XPosAvrg <> 0 Then
          channel[i] = 1 - LDMath.Truncate(XPosAvrg * (20/(gw/2)) * 100) / 100
          If channel[i] > 1 Then
            channel[i] = 1
          EndIF 
          If channel[i] < 0 Then
            channel[i] = 0
          EndIF
        EndIf
        status = status + " : " + channel[i]
      EndFor
      GraphicsWindow.Title = status  
    EndSub
    
    Sub Transmitlocation
      WaveForm.PlayDX7(channel)
      'TextWindow.WriteLine("Functioning")
    EndSub
    
    Sub BC 
      imgstart = LDWebCam.SnapshotToImageList()
      EndSub
      


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11


    Monday, October 13, 2014 2:02 AM
    Answerer
  • The GetLighness uses GetRed internally and this could crash if it is given a bad string (not a colour).

    eg. TextWIndow.WriteLine(LDColours.GetLightness("#fdfdf000000"))

    How this happens I'm not sure and cannot reproduce with your code.  I could just add a try-catch for the exception, but would rather know why, so perhaps some debugging code like this could help.

    Please try this or something similar for the GetLightness problem.

          color = LDImage.GetPixel(imgDiff,x-1,y-1)
          TextWindow.WriteLine(color)
          data[x][y] = LDColours.GetLightness(color)  

    EDIT

    I don't think its a real problem, but better to do Transmitlocation() inthe main loop - not on the Timer thread - I sometimes get a SlimDX (used by WaveForm) error (E_INVALIDARG: An invalid parameter was passed to the returning function) which could be if channel is not correctly formed (Transmitlocation called on timer thread while channel is being modified by some other thread).

    EDIT2

    You should also delete img as well as imgDiff since this will build up a lot over time.

    Sub GetImage
      LDImage.Remove(img)
      LDImage.Remove(imgDiff)
      img = LDWebCam.SnapshotToImageList()
      imgDiff = LDImage.DifferenceImages(img,imgstart)
      GraphicsWindow.DrawResizedImage(imgDiff,10,10,gw - 10,gw - 10)
      GraphicsWindow.DrawResizedImage(img,gw+10,10,gw - 10,gw - 10)
    EndSub


    Monday, October 13, 2014 6:00 PM
    Moderator
  • So there are two errors now. I suspect that there were all along but I only saw one. Here is an image:

    The top one came first, then 2 seconds or so, then the bottom. The textwindow code is here (Part of the program):

       Color = LDImage.GetPixel(imgDiff,x-1,y-1)
          TextWindow.WriteLine(Color)
          data[x][y] = LDColours.GetLightness(Color)   


    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, October 13, 2014 8:04 PM
    Answerer
  • I just uploaded a new version - there was a memory leak in the unmanaged part of the directx for the webcam.

    Try that...

    Monday, October 13, 2014 8:44 PM
    Moderator
  • That did it! My turret is fully operational! I will be posting a video as soon as I can.

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Monday, October 13, 2014 11:12 PM
    Answerer