cidetector

How to use CIDetector and CIFaceFeature with large images and different aspect ratios

南笙酒味 提交于 2020-01-06 02:55:08
问题 I've been working on this for days and all examples out there are if the image size is the same as the UIImageView. In addition, a lot of the answered on Stack are outdated. I have an app where the user can add an image, which can be of any size, and different aspect ratio, for example 750X750, 1280X920. The UIImageView is smaller of course, and the content mode is set to Aspect Fill. I did a lot of testing so this is what I have done so far: I convert the CoreImage coordinates to UIKit using

CIDetectorTypeQRCode gives error

只谈情不闲聊 提交于 2020-01-05 04:14:32
问题 let detector:CIDetector=CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: [CIDetectorAccuracy:CIDetectorAccuracyHigh])! It works fine in device but when generating build for iTunes distribution it gives error: "Value of type '[String:AnyObject]?" has no member 'Key' If I remove the option part [CIDetectorAccuracy:CIDetectorAccuracyHigh] then it gives error like: (ofType: String, context: CIContext?, options: [String : AnyObject]?) -> CIDetector' is not convertible to '(ofType:

CIDetector either not detecting, or detecting in odd places

寵の児 提交于 2019-12-24 14:35:03
问题 I am practicing using some swift 2 and have run in to some difficulties in using the CIDetector. I have an app which has a series of pictures in; three different rectangles and three different photos of people/groups. I have been just trying the CIDetector on these images to see what is recognised. The most success I have has is with the faces - however the face it's recognising are in very weird places on the image. Here is a rectangle image I tested, along with it's output: And here is a

How to change CIDetector orientation?

孤人 提交于 2019-12-22 08:06:08
问题 So I am trying to make a text detector using CIDetector in Swift. When I point my phone at a piece of text, it doesn't detect it. However, if I turn my phone to the side, it works and detects the text. How can I change it so that it detects text at the correct camera orientation? Here is my code: Prepare text detector function: func prepareTextDetector() -> CIDetector { let options: [String: AnyObject] = [CIDetectorAccuracy: CIDetectorAccuracyHigh, CIDetectorAspectRatio: 1.0] return

CIDetector won't release memory - swift

吃可爱长大的小学妹 提交于 2019-12-21 20:43:46
问题 After the face detection is done the memory will not release, is there is a way I could release it (the memory stay at 300MB after the process is done). autoreleasepool{ manager.requestImageData(for: asset, options: option){ (data, responseString, imageOriet, info) in if (data != nil){ //let faces = (faceDetector?.features(in: CIImage(data: data!)!)) guard let faces = self.faceDetector?.features(in: CIImage(data: data!)!) else { return } completionHandler((faces.count)) }else{ print(info) } }

CIDetctor always remains nil, Cant read QRCode

ε祈祈猫儿з 提交于 2019-12-08 09:46:12
问题 I cannot initialize CIDetector for reading QRCOde , It always remains nil. Here is my code : let options = [CIDetectorAccuracy: CIDetectorAccuracyHigh] self.detector = CIDetector(ofType: CIDetectorTypeQRCode, context: nil, options: options) If I replace CIDetectorTypeQRCode with CIDetectorTypeRectangle it get initialized but I need to read QRCode I am trying from last two days, Please help 回答1: Finally got that working: Follow the steps: Select XcodeProject Select Target Select BuildSettings

Does CIDetector For other Barcode Types

匆匆过客 提交于 2019-12-07 12:10:27
问题 I am looking at CIDetectorTypeQRCode. How can I detect other types of barcodes? I can read other barcode types via AVMetadataObjectType, however I want to do the same with CIDetector. I am trying to achieve real time highlighting of the barcode. Trying for a sort of zoom in effect before my AVCaptureMetadataOutputObjectsDelegate achieves a full lock and read of the code. 回答1: CIDetector has only following types to detect, So we can't use it to detect another type of barcodes.

Does CIDetector For other Barcode Types

主宰稳场 提交于 2019-12-05 18:42:23
I am looking at CIDetectorTypeQRCode. How can I detect other types of barcodes? I can read other barcode types via AVMetadataObjectType, however I want to do the same with CIDetector. I am trying to achieve real time highlighting of the barcode. Trying for a sort of zoom in effect before my AVCaptureMetadataOutputObjectsDelegate achieves a full lock and read of the code. CIDetector has only following types to detect, So we can't use it to detect another type of barcodes. CIDetectorTypeFace CIDetectorTypeRectange CIDetectorTypeQRCode CIDetectorTypeText But since iOS 11 has introduced a new set

CIDetector won't release memory - swift

扶醉桌前 提交于 2019-12-04 12:43:02
After the face detection is done the memory will not release, is there is a way I could release it (the memory stay at 300MB after the process is done). autoreleasepool{ manager.requestImageData(for: asset, options: option){ (data, responseString, imageOriet, info) in if (data != nil){ //let faces = (faceDetector?.features(in: CIImage(data: data!)!)) guard let faces = self.faceDetector?.features(in: CIImage(data: data!)!) else { return } completionHandler((faces.count)) }else{ print(info) } } } 来源: https://stackoverflow.com/questions/39869331/cidetector-wont-release-memory-swift

CIDetector not detecting proper Rectangle in iOS?

允我心安 提交于 2019-11-29 17:10:06
I am trying to detect a Rectangle using CIDetector . I am using code from this: https://www.cocoacontrols.com/controls/vnimagescanner My problem is when I am trying to detect any Rectangle object, sometimes it's detecting or sometimes it's detecting Odd Rectangle (please see below images). I tried to search this Google but didn't find any solution of this. Normal case: Some bad case: Here is my code to set the CIDetector Accuracy : func highAccuracyRectangleDetector() -> CIDetector? { var detector: CIDetector? = nil detector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: