Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2008 Get Grayscale Value of grayscale image

$
0
0
I'm making application for image recognition using grayscale image format. the problem is how to get the values ​​from the gray image.
I have a sample program but I might not be able to use this code to VB.net, because the code for vb.6. Can someone convert this code to vb.net?or do you have another solution?
I was more expecting another solution to this problem in VB.net code.

thank you very much

Code:

For Y = 1 to Picture1.scaleheight
For x = 1 to Picture1.ScaleWidht

p = Get pixel (picture1.hdc, X,Y)
r= p and &HFF
g = (p\&H100)and &HFF
b = (p\&H10000)and &HFF

grtotr=grtotr + r
grratr = Round(gtotr/(picture1.ScaleHeight*Picture1.Scalewidht),2)

grtotg=grtotg + g
grratg = Round(gtotg/(picture1.ScaleHeight*Picture1.Scalewidht),2)

grtotb=grtotb + b
grratb = Round(gtotb/(picture1.ScaleHeight*Picture1.Scalewidht),2)

Next
Next

Text1.text = grratr
Text2.text = ggratg
Text3.text = ggratb


Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>