내 응용 프로그램에서 내 이미지에 CIFilter (CIBumpDistortion)를 적용하려고합니다. 내 문제는 kcIInputCenterKey 매개 변수를 사용할 때 번호가 매겨진 좌표를 부여해야하는 것 같습니다. 나는 응용 프로그램을 실행하면,이 코드는 왼쪽 눈 좌표를 반환IOS 코어 이미지 필터 매개 변수
if (face.hasLeftEyePosition) {
NSLog("Left eye %g %g", face.leftEyePosition.x, face.leftEyePosition.y);
Hence, I can manually then enter the left eye coordinates into the kCInputCenterKey and then run the app again and the filter is applied to the left eye centre point:
let filter = CIFilter(name: "CIBumpDistortion")
filter?.setValue(ciImage, forKey: kCIInputImageKey)
filter?.setValue(0.5, forKey: kCIInputScaleKey)
filter?.setValue(200, forKey: kCIInputRadiusKey)
filter?.setValue(CIVector(x:150, y: 150), forKey: kCIInputCenterKey)
if let output = filter?.value(forKey: kCIOutputImageKey) as? CIImage {
self.chosenImage?.image = UIImage(cgImage: context.createCGImage(output, from: output.extent)!)
을 그러나, 나는 사용자가 원하는대로 사용하기 위해 이미지를 선택 할 수 있도록, 나는 왼쪽 눈의 위치를 찾아 적용하는 엑스 코드가 필요합니다 수동으로 좌표를 입력하지 않고도 영역에 필터를 적용 할 수 있습니다.
x, y 좌표에 필요한 숫자 대신 문자열, 다른 유형 등을 사용해 보았습니다. 모두 행운이 없습니다.
어떤 도움을 주셔서 감사합니다.
안녕하세요, dfd, 많은 의견에 감사드립니다. 나는 일반적으로 코딩하기가 비교적 새로운데 제스처 인식기를 사용해 보지 않았을 것입니다! 다시 한 번 고마워, 나는 또 한번 그것을 줄 것이다. – Henry