• <bdo id='LUSq9'></bdo><ul id='LUSq9'></ul>
  • <small id='LUSq9'></small><noframes id='LUSq9'>

  • <i id='LUSq9'><tr id='LUSq9'><dt id='LUSq9'><q id='LUSq9'><span id='LUSq9'><b id='LUSq9'><form id='LUSq9'><ins id='LUSq9'></ins><ul id='LUSq9'></ul><sub id='LUSq9'></sub></form><legend id='LUSq9'></legend><bdo id='LUSq9'><pre id='LUSq9'><center id='LUSq9'></center></pre></bdo></b><th id='LUSq9'></th></span></q></dt></tr></i><div id='LUSq9'><tfoot id='LUSq9'></tfoot><dl id='LUSq9'><fieldset id='LUSq9'></fieldset></dl></div>
    1. <tfoot id='LUSq9'></tfoot>
        <legend id='LUSq9'><style id='LUSq9'><dir id='LUSq9'><q id='LUSq9'></q></dir></style></legend>

        如何使用 Zbar 裁剪扫描的条码?

        时间:2024-04-14

              <bdo id='r2nhZ'></bdo><ul id='r2nhZ'></ul>
              <legend id='r2nhZ'><style id='r2nhZ'><dir id='r2nhZ'><q id='r2nhZ'></q></dir></style></legend>

              <small id='r2nhZ'></small><noframes id='r2nhZ'>

              <i id='r2nhZ'><tr id='r2nhZ'><dt id='r2nhZ'><q id='r2nhZ'><span id='r2nhZ'><b id='r2nhZ'><form id='r2nhZ'><ins id='r2nhZ'></ins><ul id='r2nhZ'></ul><sub id='r2nhZ'></sub></form><legend id='r2nhZ'></legend><bdo id='r2nhZ'><pre id='r2nhZ'><center id='r2nhZ'></center></pre></bdo></b><th id='r2nhZ'></th></span></q></dt></tr></i><div id='r2nhZ'><tfoot id='r2nhZ'></tfoot><dl id='r2nhZ'><fieldset id='r2nhZ'></fieldset></dl></div>
                <tbody id='r2nhZ'></tbody>

              1. <tfoot id='r2nhZ'></tfoot>

                1. 本文介绍了如何使用 Zbar 裁剪扫描的条码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用下面的代码使用 Zbar sdk 扫描条形码.

                  I am using below code to scan bar code using Zbar sdk.

                  我通过 stackoverflow 的相关问题 但这个答案对我不起作用.

                  I go through related question of stackoverflow but that answer is not working for me.

                  到目前为止,我已经完成了,

                  Till now I have done,

                  -(IBAction)btnCLick
                      {
                          ZBarReaderViewController *reader = [ZBarReaderViewController new];
                          reader.readerDelegate = self;
                          reader.supportedOrientationsMask = ZBarOrientationMaskAll;
                  
                          ZBarImageScanner *scanner = reader.scanner;
                          [scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
                  
                  
                          [self presentModalViewController:reader animated:YES];
                          [reader release];
                      }
                  
                  - (void) imagePickerController: (UIImagePickerController*) aReader
                       didFinishPickingMediaWithInfo: (NSDictionary*) info
                      {
                  
                          id<NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults];
                  
                          ZBarSymbol *symbol = nil;
                  
                          for(symbol in results)
                          {
                              break;
                          }
                          txtViewResult.text = symbol.data;
                          imgViewResult.image = [info objectForKey:UIImagePickerControllerOriginalImage];
                  
                          [self advanceCrop:imgViewResult];
                          [reader dismissModalViewControllerAnimated:YES];
                  
                      }
                  

                  advanceCrop 方法正在做裁剪,

                  advanceCrop Method is doing crop,

                  -(void)advanceCrop:(UIImageView *)aimgViewResult
                      {
                  
                  
                          CGRect r =CGRectMake(50/426., 1-(20+250)/320., 150/426., 250/320.);
                          reader.scanCrop = r;
                  
                  
                          r = CGRectMake(20, 50, 250, 150);
                  
                          imgViewResult.frame = r;
                          NSLog(@"imgview height:%f width:%f",imgViewResult.frame.size.height, imgViewResult.frame.size.width);
                  
                  
                          /*
                  
                         // CGRect r = CGRectFromString(lblImage.text);
                         CGRect r = CGRectMake(50/426., 1-(20+250)/320., 150/426., 250/320.);
                  
                          reader.scanCrop = r; 
                          NSLog(@"r: x:%f  y:%f height :%f  width:%f",r.origin.x ,r.origin.y ,r.size.height , r.size.width);
                  
                         // aLblImage.text = NSStringFromCGRect(r);
                  
                          r.origin.x *= 426;
                          r.origin.y *= 320;
                          r.size.width *= 426;
                          r.size.height *= 320;
                  
                          imgViewResult.frame = r;
                          NSLog(@"imgview height:%f width:%f",imgViewResult.frame.size.height, imgViewResult.frame.size.width);
                           */
                      }
                  

                  如果我得到如下图像并且我想裁剪它,Zbar 可以吗?

                  If I am getting Image as below and I want to crop it, is it possible with Zbar?

                  推荐答案

                  试试这个.如果CGRect = CGRectMake(x, y, width, height);,那么做:

                  Try this. If CGRect = CGRectMake(x, y, width, height);, then do:

                  float A = y / readerView.bounds.size.height;   
                  float B = 1 - (x + width) / readerView.bounds.size.width;   
                  float C = (y + height) / readerView.bounds.size.height;   
                  float D = 1 - x / readerView.bounds.size.width;;  
                  CGRectMake( A, B, C, D );
                  

                  这篇关于如何使用 Zbar 裁剪扫描的条码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:自动布局 UIImageView 与编程重新大小不遵循约束 下一篇:kCAFilterNearest 放大过滤器 (UIImageView)

                  相关文章

                2. <tfoot id='NKnEx'></tfoot>

                  <i id='NKnEx'><tr id='NKnEx'><dt id='NKnEx'><q id='NKnEx'><span id='NKnEx'><b id='NKnEx'><form id='NKnEx'><ins id='NKnEx'></ins><ul id='NKnEx'></ul><sub id='NKnEx'></sub></form><legend id='NKnEx'></legend><bdo id='NKnEx'><pre id='NKnEx'><center id='NKnEx'></center></pre></bdo></b><th id='NKnEx'></th></span></q></dt></tr></i><div id='NKnEx'><tfoot id='NKnEx'></tfoot><dl id='NKnEx'><fieldset id='NKnEx'></fieldset></dl></div>

                    • <bdo id='NKnEx'></bdo><ul id='NKnEx'></ul>
                    <legend id='NKnEx'><style id='NKnEx'><dir id='NKnEx'><q id='NKnEx'></q></dir></style></legend>

                    <small id='NKnEx'></small><noframes id='NKnEx'>