#書類や標識の検出に
四角形の人工物を検出できれば、場面に応じて様々な用途に活かせそうです。
例えば、ドキュメント内の四角形の検出など。
#Visionの四角形検出が使える
。
#方法
画像にVNDetectRectangleRequestをするだけです。
let request = VNDetectRectanglesRequest()
let handler = VNImageRequestHandler(ciImage: ciImage!, options: [:])
try! handler.perform([request])
guard let results = request.results else { return }
for result in results {
print("topLeft: \(result.topLeft)")
print("topRight: \(result.topRight)")
print("bottomLeft: \(result.bottomLeft)")
print("bottomRight: \(result.bottomRight)")
print("boundingBox: \(result.boundingBox)")
}
topLeft: (0.37335851788520813, 0.5885436534881592)
topRight: (0.5980302095413208, 0.6653665900230408)
bottomLeft: (0.45727139711380005, 0.16498719155788422)
bottomRight: (0.7020156383514404, 0.26323217153549194)
boundingBox: (0.37335851788520813, 0.16498719155788422, 0.3286571204662323, 0.5003793984651566)
画像内の正規化座標を取得できます。
Y座標は、画像の下が基準になっています。
🐣
フリーランスエンジニアです。
お仕事のご相談こちらまで
rockyshikoku@gmail.com
Core MLやARKitを使ったアプリを作っています。
機械学習/AR関連の情報を発信しています。