المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Webcam QR barcode decoder problem



C# Programming
06-17-2009, 09:02 AM
im doing a QR barcode decoder using my webcam. my way is take a picture of the barcode and use that picture do decode the barcode. i found sample coding in this artical




when i use that coding it picture should be more clear.

now im trying this code

but got few error can anyone just help me...thanks
private void button2_Click(object sender, EventArgs e)
{
unsafe
{
Image image = Image.FromFile("D:\\1.JPG");
BitmapData bd = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
int sourceWidth = image.Width * System.Runtime.InteropServices.Marshal.SizeOf(typeof(PixelData));
if (sourceWidth % 4 != 0)
sourceWidth += (4 - (sourceWidth % 4));
Byte* bitmapBaseByte;
bitmapBaseByte = (Byte*)bd.Scan0.ToPointer();
PixelData* pPixel;
for (int y = 0; y < height; y++)
{
pPixel = (PixelData*)(bitmapBaseByte + y * sourceWidth);
for (int x = 0; x < width; x++)
{
intImage[x][y] = (int)((0xff red green blue);
pPixel++;
}
}

image.UnlockBits(bd);
}
i got errors in

BitmapData bd = image.LockBits(new Rectangle(0.....this line LockBits.....

and over here too

PixelData* pPixel;

anyone just help me....thanks...

A S E L A