objective c - Scaning static UIImage using ios ZBar SDK -
I want to scan a static UIImage using Zbar sdk, this gives an error that means ZBarSymbol faucet
I, because it is a subclass of UIMAPP Controller and I do not want to use the UIMAPPC Controller at all because I just want to scan. I also for ZBarImageScanner Tried, Change a stripped-down ZBAR_I25 normal version desired code format.
- (zero) scanFromUIIage: (UIImage *) img {// Setup Scanner ZBarImageScanner * Scanner = [[ZBarImageScanner alloc] init]; Settings * Settings = [Settings Global Settings]; // ZBarImageScanner * scanner = reader scanner; BOOL is Longliner = No; (Settings.enabledSymbologies in NSString * str) {NSNumber * value = [settings.enabledSymbologies objectForKey: str]; BOOL enabled = value.boolValue; Zbar_symbol_type_t sym = [integer value]; [Scanner Setsimmology: Sim Config: ZBAR_CFG_ENABLE: Enabled]; If (sym == ZBAR_EAN13) {// show EAN forms like [scanner set simmology: ZBAR_UPCA config: ZBAR_CFG_ENABLE to: enable]; [Scanner Setsimmology: ZBAR_UPCE Config: ZBAR_CFG_ENABLE: Enabled]; [Scanner SetSybologia: ZBAR_ISBN13 config: ZBAR_CFG_ENABLE: Enabled]; } Are longliner. = Enabled & amp; Amp; SIM & gt; ZBAR_COMPOSITE & amp; Amp; Sym! = ZBAR_QRCODE; } ZBarImage * zbimg = [[ZBarImage alloc] initWithCGImage: img.CGImage]; UIImage * image = screenShot; Id & lt; NSFastEnumeration & gt; Result = [scanner scan image: zbimg]; // NSLog (@ "------- & gt;% @", results); ZBarSymbol * sym = zero; (Result in sim) break; (Symbol) claims; (Image) claims; Return (! SYM || | image); Barcode * Barcode = [NSEntityDescription insertNewObjectForEntityForName: @ Managed Object Contains in "Barcode": Reference]; (Barcode) claims; If (! Barcode) return; Emphasis (currentFolder); // wana Safari folder folder to save Safari screen shot * folder = zero; Folder = [folder default folder encontax: reference]; If (folder! = Current folder) {[currentFolder release]; CurrentFolder = [folder maintained]; } Barcode.folder = currentFolder; Barcodet = [NSDT Date]; Barcode.image = image; Barcode.symbol = sym; Barcode.type = [NSNumber NumberVideo: SIM. Type]; Barcode.data = sym.data; Barcode.name = zero; Barcode Thumb = zero; NSArray * stack = nav.viewControllers; Barcode List Controller * _list = Zero; If (stackdowns gt; 1) {_list = [stack object endx: 1]; If (! [_ List Hakindofclas [barcode Listkantrolr class]] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = _ =;} if (_list) [New Poptouwu controller animate the went List: No ]; other {[New Poptoatwuk Niyntrkanumti: No]; _list = [[[barcode list controller alloc] initWithFolder: currentFolder] autorelease]; [App push ViewController: _list animated: No];} UIViewController * expansion = [[Barkodditestkantrolr Alloc] InitWithBarcode: Barcode]; [Nav PushviewController: Animated Description: No]; [Extension Release]; ettings.autoLink) [performs self selector: @ selector (AutoLink) withObject: After barcode Dale: 0.25]; [Window.rootViewController adDismissModalViewController: Self Safari animated: YES]; [self demonstrator with @ selector (Gintumb :) Object: Del bar after barcode: .5];}
- (NSString *) Dundenkyuarkod: (UIImage *) Inputumej {ZBarReaderControlle R * imageReader = [ZBarReaderController new]; [ImageReader.scanner set synthetic: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0]; Id & lt; NSFastEnumeration & gt; Results = [imageReader scanImage: inputUIImage.CGImage]; ZBarSymbol * sym = zero; (Result in sim) {break; } // Only get the last symbol if (! Sym) {NSLog (@ "no barcode is found"); Return zero; } NSLog (@ "Barcode Found! Quality:% d string:% @", sym.quality, sym.data); Simadata return; }
Comments
Post a Comment