Color difference
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
Again me....
I am making Motion Detection, and i have three picBox's, one for current preview, one for 'last frame' (5secs ago frame) and one for difference between those two.
Now, my camera and i belive every others gets picture (frame) with different brightness every time. When i use simple code to compare each pixel in first two image box's, only a few stay the same(10 out of 150*150). Other pixels are let's say 5% diffrent, darker or lighter. How could i fix this ?
Edit:
I even tried to check each pixel in one picture with 5 pixels in different picture (x,y)=(x,y)
(x,y)=(x+1,y)
(x,y)=(x,y+1)
(x,y)=(x,y-1)
(x,y)=(x-1,y)
Still not much difference.
I am making Motion Detection, and i have three picBox's, one for current preview, one for 'last frame' (5secs ago frame) and one for difference between those two.
Now, my camera and i belive every others gets picture (frame) with different brightness every time. When i use simple code to compare each pixel in first two image box's, only a few stay the same(10 out of 150*150). Other pixels are let's say 5% diffrent, darker or lighter. How could i fix this ?
Edit:
I even tried to check each pixel in one picture with 5 pixels in different picture (x,y)=(x,y)
(x,y)=(x+1,y)
(x,y)=(x,y+1)
(x,y)=(x,y-1)
(x,y)=(x-1,y)
Still not much difference.
You could have a threshold.
Code: Select all
Just edit the value of 'Threshold' to fit your needs. Larger values means that bigger changes are accepted, smaller values means that the pixels only have to change a little bit for it to accept. Dim Treshold As Byte = 5
Dim rDifference As Byte = Math.Abs(OldRed - NewRed)
Dim gDifference As Byte = Math.Abs(OldGreen - NewGreen)
Dim bDifference As Byte = Math.Abs(OldBlue - NewBlue)
If rDifference > Treshold Then
'Red value has changed more than 5 pixels'
End If
If gDifference > Treshold Then
'Green value has changed more than 5 pixels'
End If
If bDifference > Treshold Then
'Blue value has changed more than 5 pixels'
End If
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

I did exactly the same if you believe me 
My function uses two colors, gets it's argb and gets difference between each (A,R,G,B) and if it's combined difference is less then 35 it returns that they are same.
Thank you btw, +rep you

My function uses two colors, gets it's argb and gets difference between each (A,R,G,B) and if it's combined difference is less then 35 it returns that they are same.
Thank you btw, +rep you
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023