yklam
August 4, 2003, 09:18:50
Hello,
I was trying to extract the pixel value of color images (RGB24) with resolution of 320 x 240 pixels. From the documentation, I know that the images will have 3 bytes per pixel, and the image buffer will be 960 by 240 bytes in size. Therefore, I assume that Red plane is located at pixel 0 to 319; Green plane is at pixel 320 to 639; Blue plane is at pixel 640 to 959. Below is the example code that I wrote to extract Blue plane pixel value.
For y = 0 To ICImagingControl1.ImageHeight - 1
For x = 0 To 3 * ICImagingControl1.ImageWidth - 1
If x = 250 + 321 + 321 And y = 40 Then
Text2.Text = Text2.Text & ImageData(x, y) & vbCrLf
End If
Next x
Next y
My problem is the pixel value seems to be varied from what I got from other painting software. [image attached] For example, at pixel [250, 40], I suppose to get RGB(255, 143, 102) but I got RGB(110, 121, 102) instead. For your information, I assume Red value is at pixel [250,40], Green value is at pixel [250+321, 40] and Blue value is at pixel [250+321+321, 40].
It is very important for me to indentify the pixel value for each of the plane for color classification. Could you please explain how am I suppose to extract the RGB value from each of RGB plane? I guess I have used the wrong way :)
Thank you very much.
Best regards,
yklam
I was trying to extract the pixel value of color images (RGB24) with resolution of 320 x 240 pixels. From the documentation, I know that the images will have 3 bytes per pixel, and the image buffer will be 960 by 240 bytes in size. Therefore, I assume that Red plane is located at pixel 0 to 319; Green plane is at pixel 320 to 639; Blue plane is at pixel 640 to 959. Below is the example code that I wrote to extract Blue plane pixel value.
For y = 0 To ICImagingControl1.ImageHeight - 1
For x = 0 To 3 * ICImagingControl1.ImageWidth - 1
If x = 250 + 321 + 321 And y = 40 Then
Text2.Text = Text2.Text & ImageData(x, y) & vbCrLf
End If
Next x
Next y
My problem is the pixel value seems to be varied from what I got from other painting software. [image attached] For example, at pixel [250, 40], I suppose to get RGB(255, 143, 102) but I got RGB(110, 121, 102) instead. For your information, I assume Red value is at pixel [250,40], Green value is at pixel [250+321, 40] and Blue value is at pixel [250+321+321, 40].
It is very important for me to indentify the pixel value for each of the plane for color classification. Could you please explain how am I suppose to extract the RGB value from each of RGB plane? I guess I have used the wrong way :)
Thank you very much.
Best regards,
yklam