- SeSAC AI를 활용한 iOS 앱개발 과정 하업서
- AR활용 이미지 인식·검출·추적·증강 및 ChatGPT API 활용 이미지 검색·결과 출력 기능 개발
- UIKit
- ARKit
- RealityKit
- Combine
- CoreImage
- Vision
- ChatGPT Vision API
- Google Custome Search API
![Screenshot 2024-04-30 at 9 30 25 PM](https://private-user-images.githubusercontent.com/83139316/326805878-5739ce54-47c0-444d-ad31-adcdfc2f5872.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5MTk5NjEsIm5iZiI6MTcyMzkxOTY2MSwicGF0aCI6Ii84MzEzOTMxNi8zMjY4MDU4NzgtNTczOWNlNTQtNDdjMC00NDRkLWFkMzEtYWRjZGZjMmY1ODcyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDE4MzQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY3ZDU4MTNjMjA5ZjU2MTYwZWE5MzFmYzJkMGMwZTAyODMyMmJhMGM1OWU3Y2Q4ZDAwMThiNTVhOTJmMmU5NmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.560AzGlsRabP-cD3XtKfVZdbwKHQYFrf5B9azjsvl2Q)
![Screenshot 2024-04-30 at 9 30 32 PM](https://private-user-images.githubusercontent.com/83139316/326805895-9f9ad520-1a5d-4676-a1a4-9eb2e2052b0f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5MTk5NjEsIm5iZiI6MTcyMzkxOTY2MSwicGF0aCI6Ii84MzEzOTMxNi8zMjY4MDU4OTUtOWY5YWQ1MjAtMWE1ZC00Njc2LWExYTQtOWViMmUyMDUyYjBmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDE4MzQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU0YTc4MGU1YTdkMGY2MWFhYmQxNDcyMzdiYzZiMjQ2MWExZjUzNzgxNGRlN2M0OThhNGFjNWJkNTc5NzNiN2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.C4e0v45IrR-6yjdzhR1xw02HkbWjScLZR4b7wYCA-g4)
![Screenshot 2024-04-30 at 9 02 08 PM](https://private-user-images.githubusercontent.com/83139316/326804156-fa0cb4a2-b89a-4735-9e50-a9276d43cae8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5MTk5NjEsIm5iZiI6MTcyMzkxOTY2MSwicGF0aCI6Ii84MzEzOTMxNi8zMjY4MDQxNTYtZmEwY2I0YTItYjg5YS00NzM1LTllNTAtYTkyNzZkNDNjYWU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE3VDE4MzQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhNDJmNTE5YzFjMjhiODBkOTBhYWEzYWE2NmUyZWRkOWYxMTcyMzE3YjZiZWE0Nzg1MzkwMzJjYjc4MGM2OTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.i3HzyqZmJSc18E9r8xqZcuo_1ZkXKf0qGisQCsov-Zo)
-
마커 등록 asset에 ARResourc를 통해서 등록했습니다.
-
이미지 인식 및 앵커 생성
func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
for anchor in anchors {
guard let imageAnchor = anchor as? ARImageAnchor else { return }
handleImageAnchor(imageAnchor)
}
}
- 이미지 트래킹
func resetTracking() {
guard let referenceImages = ARReferenceImage.referenceImages(inGroupNamed: "AR Resources", bundle: nil) else { return }
arConfiguration.trackingImages = referenceImages
arView.session.run(arConfiguration, options: [.resetTracking, .removeExistingAnchors])
}
- 이미지 추출 - 이미지 모서리 꼭지점 계산
guard let topLeft = arView.project(imageAnchorPosition + SIMD3<Float>(-referenceImageWidth/2, referenceImageHeight/2, 0)),
let bottomLeft = arView.project(imageAnchorPosition + SIMD3<Float>(-referenceImageWidth/2, -referenceImageHeight/2, 0)),
let topRight = arView.project(imageAnchorPosition + SIMD3<Float>(referenceImageWidth/2, referenceImageHeight/2, 0)),
let bottomRight = arView.project(imageAnchorPosition + SIMD3<Float>(referenceImageWidth/2, -referenceImageHeight/2, 0)) else { return }
- 이미지 왜곡 보정 - CIImage
private func cropImageForPoints(image: CIImage, topLeft: CGPoint, topRight: CGPoint, bottomLeft: CGPoint, bottomRight: CGPoint) -> CIImage? {
let perspectiveTransformFilter = CIFilter.perspectiveCorrection()
perspectiveTransformFilter.inputImage = image
perspectiveTransformFilter.topLeft = CGPoint(x: topLeft.x - 10, y: image.extent.size.height - topLeft.y + 40)
perspectiveTransformFilter.topRight = CGPoint(x: topRight.x - 35, y: image.extent.size.height - topRight.y + 40)
perspectiveTransformFilter.bottomLeft = CGPoint(x: bottomLeft.x - 10, y: image.extent.size.height - bottomLeft.y + 30)
perspectiveTransformFilter.bottomRight = CGPoint(x: bottomRight.x - 35, y: image.extent.size.height - bottomRight.y + 30)
return perspectiveTransformFilter.outputImage!
}
-
네트워크 통신 클린 아키텍처와 Combine을 결합하여 통신을 구현했습니다. Data Layer내부 파일들을 확인 바랍니다.
-
유사도 측정 ImageSimilarityAnalyzer에서 애플 Vision 프레임워크를 활용해서 이미지 간의 유사도 거리를 측정합니다.
- 동봉된 Marker를 Asset ARResource에 등록하여 활용 (기본 printed 이미지 마커 등록되어 있음)