核心图像人脸检测可提供零张人脸-xamarin.ios

问题描述

我有一个使用Core Image face detection Doc的xamarin.iOS应用。我有一个自定义的相机视图,当我们拍摄照片时,如果图像中包含任何面孔,我会采取一些措施。人脸检测可在大多数iPhone上使用。当我在使用iOs 10.3.4的旧iPad上进行测试时,即使我捕捉人脸人脸检测方法也可以将人脸计数设为零。

人脸检测实现

private async Task FaceDetectionCheking(UIImage photo)
        {           
                try
                {
                    var imageFile = photo;                  
                    var context = new CIContext();
                    var detector = CIDetector.CreateFaceDetector(context,true);
                    var ciImage = CIImage.FromCGImage(imageFile.CGImage);
                    var features = detector.FeaturesInImage(ciImage);                   
                            
                    if (features.Length == 0)
                    {
                       // No face detected.
                    }
                    else if(features.Length == 1)
                    {
                        // Single face detected
                    }
                    else if(features.Length > 1)
                    {
                        // Multiple face detected !
                    }
                
                }

                catch (Exception ex)
                {

                }
        }

设备是否有可能不支持此面部检测API?如果是这种情况,我如何检查它是否支持?任何帮助都可以申请。

修改

听起来可能很有趣。如果我们捕获互联网照片的面部,则面部检测会起作用。不是我的。 :D但是可以在所有其他设备上使用。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)