I'm making simple application for image recognition using grayscale image format. The problem is how to get the value of a grayscale image. Its value is RGB or pixel. Then the value will be used as a comparison between the sample images with the image to be recognized.

I have a sample program but can not use this code to VB.net, because the code for vb.6. Can someone help me 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
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)

' the result of the calculation transferred to textbox
Text1.text = grratr ' R value
Text2.text = ggratg 'G value
Text3.text = ggratb ' B value