I'm trying to use OpenCV with iOS. Everything works fine when I use an image included in the application through Xcode.
However I need to read an image taken through the camera. I've tested numerous suggestions from here on StackOverflow and other sites, but to no luck.
I have tried using OpenCV's UIImageToMat, and I have tried saving the image to the Documents Directory on the device, and then reading this file in through imread().
Unfortunately the Mat object's data is NULL and the matrix is empty. Has anybody got any ideas?
let filename = getDocumentsDirectory().appendingPathComponent("temp.jpg")
try? dataImage.write(to: filename)
let test = OpenCVWrapper()
let plate = test.getLicensePlate(filename.absoluteString)
print(plate ?? "nil")
I have checked that the file does indeed exist in the documents directory, so I really have no idea what's going on!