#54 Error in camera layer moved 20 pixel in new iOS

open-rejected
spadix
iPhone (9)
5
2011-05-13
2011-05-12
No

This only happens in a new iOS. Like you can see in video, the zbar start the video camera in wrong way (happens only in ZBarReaderController, not in ZBarReaderViewController ). Fist it show my overlay, than show the Apple camera animation (a lens opening) and when it show the camera zbar layer, it is about 20 pixel error (it\'s look like the IPhone system bar size). If I turn off my overlay, the camera layer is still 20 pixel error.
This test was made in an iPhone 4, with iOS 4.3, The same test in the same way in a iPhone 3GS with iOS 3.1.3 don\'t have any of this problem. I am using the ZBarSDK 1.1

Ps: The stupid firewall block all uploads site (and source forge only allow 256kb), I will send the video link when i went in home.

The exact zbar code that I execute to this happens is:
vcBarCodeReader = [ZBarReaderController new];
vcBarCodeReader.readerDelegate = self;
vcBarCodeReader.sourceType = UIImagePickerControllerSourceTypeCamera;
vcBarCodeReader.cameraOverlayView = vwBarCodeOverlay2of5;

vcBarCodeReader.sourceType = ZBarReaderControllerCameraModeSampling;
vcBarCodeReader.showsZBarControls = NO;
vcBarCodeReader.showsHelpOnFail = NO;
vcBarCodeReader.showsCameraControls = NO;
vcBarCodeReader.maxScanDimension = 640*2;

ZBarImageScanner *zbScanner = vcBarCodeReader.scanner;
zbScanner.enableCache = NO;
[zbScanner setSymbology:ALL config:ZBAR_CFG_ENABLE to:OFF];
[zbScanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:ON];
[zbScanner setSymbology:ZBAR_I25 config:ZBAR_CFG_X_DENSITY to:OFF];
[zbScanner setSymbology:ZBAR_I25 config:ZBAR_CFG_Y_DENSITY to: ON];

CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 27.0); //If i put this transform off, the error continue
vcBarCodeReader.cameraViewTransform = translate;

CGAffineTransform scale = CGAffineTransformScale(translate, 1.125, 1.125);
vcBarCodeReader.cameraViewTransform = scale;
[self presentModalViewController:vcBarCodeReader animated:YES];

Discussion

  • spadix

    spadix - 2011-05-12

    > only happens in a new iOS.
    > happens only in ZBarReaderController, not in ZBarReaderViewController

    ZBarReaderController is only for scanning images (or ancient iOS 3 compatibility); you should not be using it with iOS 4... Why would you want this combination?

     
  • spadix

    spadix - 2011-05-12
    • status: open --> pending-rejected
     
  • Rodrigo Zanatta Silva

    hum.. What I understand in all doc is that ZBarReaderController is only for photo and ZBarReaderViewController is only for video (real time). Ok, the "ZBarReaderViewController" is a child of ZBarReaderController so have all functionality. I can try it to use photos (and will check if work).

    But, if the problem is use the "take photo" for iOS 4, and not only use the video mode, this I have the answer. The resolution of photo is very bigger than video frame. Because my barcode is a big i2/5, it will ONLY be decoded with photo system. I tried it in real time, but only photo work. Is this the problem?

     
  • Rodrigo Zanatta Silva

    • status: pending-rejected --> open-rejected
     
  • spadix

    spadix - 2011-05-13
    • status: open-rejected --> pending-rejected
     
  • spadix

    spadix - 2011-05-13

    > ZBarReaderController is only for photo

    Correct

    > ZBarReaderViewController is only for video (real time)

    Correct

    > "ZBarReaderViewController" is a child of ZBarReaderController

    False - ZBarReaderViewController is a new subtype of UIViewController that emulates only some functionality of ZBarReaderController.

    > Because my barcode is a big i2/5, it will ONLY be decoded with photo system.

    Your configuration is confusing (and buggy):

    vcBarCodeReader.sourceType = UIImagePickerControllerSourceTypeCamera;
    vcBarCodeReader.sourceType = ZBarReaderControllerCameraModeSampling;

    I read this as indicating that you wanted to scan from video? The second line should be removed...

    OK, now that we understand why/how you're using ZBarReaderController, you should:
    1. Reproduce the problem with just UIImagePickerController (of which ZBarReaderController is a subclass)
    2. Take the problem up with Apple :)

    If you look through the code, you can verify that ZBarReaderController does not do anything with the overlay, it's all handled by UIImagePickerController... fwiw- you may want to check your overlay view to make sure that, eg, the resizing behavior is correct...

     
  • Rodrigo Zanatta Silva

    Wow.. I don't see this:
    vcBarCodeReader.sourceType = UIImagePickerControllerSourceTypeCamera;
    vcBarCodeReader.sourceType = ZBarReaderControllerCameraModeSampling;
    Stupid useless code :P

    I really know that ZBarReaderViewController isn't children of ZBarReaderController. I only don't understand the problem using the ZBarReaderController. (I thought this was one)...
    So the problem isn't in the layer of the ZBar library... I will try to do what you say.

    But, because my use: I will aways use the "photo system", so using the ZBarReaderController only for old system isn't a good idea.

    In the end of day, I will give the answer to this bug.

     
  • Rodrigo Zanatta Silva

    • status: pending-rejected --> open-rejected
     
  • Rodrigo Zanatta Silva

    I fix this in my code. If you thing is a good idea put in ZBar code, what I do was:

    //This is the most important
    float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
    if (ver>=4) {
    ZBarReaderController.cameraViewTransform = CGAffineTransformMakeScale(1, 1.3);
    }
    //and this is your own config
    else {
    CGAffineTransform translate = CGAffineTransformMakeTranslation(0.0, 27.0);
    CGAffineTransform scale = CGAffineTransformScale(translate, 1.125, 1.125);
    ZBarReaderController.cameraViewTransform = scale;
    }

     

Log in to post a comment.