0

長方形を複製して指定するビットマップがあります-現在の長方形には、QRコードの長方形をチェックするために使用した特定の幅と高さの値があります。これが左上隅をチェックしていることに気付きました。これを変更して、同じサイズ(幅と高さ)の右上隅、右下隅、左隅を確認できますか?

 Bitmap result = fullImg.Clone(new System.Drawing.Rectangle(0, 0, 375, 375), fullImg.PixelFormat);

どんな助けでも大歓迎です。

for (int pg = 0; pg < inputDocument.PageCount; pg++)
            {

                string workGif = workingFilename.Replace(".pdf", string.Format(".{0}.gif", pg + 1));
                GhostscriptWrapper.GeneratePageThumb(workingFilename, workGif, pg + 1, 300, 300); // size (last two params) does not seem to have any effect
                using (var fullImg = new Bitmap(workGif))
                {  
                        Bitmap result = fullImg.Clone(new System.Drawing.Rectangle(0, 0, 375, 375), fullImg.PixelFormat);
                        string QRinfo = Process(result);
                        MessageBox.Show(QRinfo);

                        string[] qcode = QRinfo.Split('/');
                        string gid = qcode[qcode.Count() - 1];
                        Guid pgGuid = new Guid(gid);
                }        
            }

qrの処理方法

public string Process(Bitmap bitmap)
    {
        var reader = new com.google.zxing.qrcode.QRCodeReader();

        try
        {
            LuminanceSource source = new RGBLuminanceSource(bitmap, bitmap.Width, bitmap.Height);
            var binarizer = new HybridBinarizer(source);
            var binBitmap = new BinaryBitmap(binarizer);
            return reader.decode(binBitmap).Text;
        }
        catch (Exception e)
        {
            return e.Message;
        }
    }
4

1 に答える 1

0

QRコードが常に角にある場合は、Bitmapにピクチャボックスを使用してから、RotateFlipメソッドを使用して回転させることができます:

Bitmap bp = new Bitmap("myImage.jpg");
pictureBox1.Image = bp;
bp.RotateFlip(RotateFlipType.Rotate90FlipNone);
pictureBox1.Invalidate();
于 2013-03-07T21:07:59.563 に答える