Posts

Post marked as solved
2 Replies
In a playground now, I have the following code let orginalImage = UIImage.init(named: imageArray[0]) let inputImage = CIImage.init(cgImage: (orginalImage?.cgImage)!) let contourRequest = VNDetectContoursRequest.init() contourRequest.detectDarkOnLight = true contourRequest.contrastAdjustment = 1.0 let areaOfIntrest = CGRect(x: 0, y: 0, width: 50, height: 50) let roi = VNNormalizedRectForImageRect(areaOfIntrest, 3264, 2448) contourRequest.regionOfInterest = roi let requestHandler = VNImageRequestHandler(cgImage: (orginalImage?.cgImage)!, options: [:]) do{     try requestHandler.perform([contourRequest]) }catch{     print("error in perform") } let observations = contourRequest.results?.first as! VNContoursObservation print(observations.contourCount) let imageContours = drawContours(contoursObservation: observations, sourceImage: (orginalImage?.cgImage)!) print(imageContours.size) But I still get contours that our outside of the Region of Interest. Which I would think would be a rectangle that his 50 x 50 and starts in the lower left corner. Am I misunderstanding how the region of interest works.
Post not yet marked as solved
3 Replies
So after mounting the iPad I am now getting continuous calls to the completion handler, however I am still not seeing any observations when rolling a soccer ball through the camera's view. I have not set any minimum or maximum size and the trajectory length is set to 5, so if I am understanding things should give me the most opportunities to detect a path. Any other thoughts on what could be happening?