zoukankan      html  css  js  c++  java
  • How to crop scanned barcode using Zbar?

    http://pastebin.com/wSVW1tRc

    CGRect scanCrop

    The region of the video image that will be scanned, in normalized image coordinates. Note that the video image is in landscape mode (default {{0, 0}, {1, 1}})

    The coordinates for all of the arguments is in a normalized float, which is from 0 - 1. So, in normalized value, theView.width is 1.0, and theView.height is 1.0. Therefore, the default rect is {{0,0},{1,1}}.

    So for example, if I have a transparent UIView named scanView as a scanning region for myreaderView. Rather than do :

    readerView.scanCrop = scanView.frame;

    We should do this, normalizing every arguments first :

    CGFloat x,y,width,height;  
    x = scanView.frame.origin.x / readerView.bounds.size.width;
    y = scanView.frame.origin.y / readerView.bounds.size.height;
    width = scanView.frame.size.width / readerView.bounds.size.width;
    height = scanView.frame.size.height / readerView.bounds.size.height;
    
    readerView.scanCrop =CGRectMake(x, y, width, height);

    It works for me. Hope that helps.

  • 相关阅读:
    1004: 画图
    1002: 数字排序问题
    1003: 相邻数对问题
    1001: 图像旋转问题
    1000: 数塔
    springday05-go1
    springday04-go2
    springday04-go1
    springday03-go2
    Android—PopupWindow的简单使用
  • 原文地址:https://www.cnblogs.com/neozhu/p/2806484.html
Copyright © 2011-2022 走看看