[英]Face Detection in Preview Camera Feed on Flutter
How do we "draw a square" on detected faces on camera preview feed in Flutter?我们如何在 Flutter 中的相机预览提要中检测到的面部上“画一个正方形”? Is there a cross platform solution to this?
是否有跨平台解决方案?
Flutter provides a Camera Plugin , but is there a way for us to draw a square box detecting faces on the preview feed ? Flutter提供了一个Camera Plugin ,但是有没有办法让我们在preview feed上画一个检测人脸的方框呢? Any thoughts on this please?
请问有什么想法吗?
. .
SOMETHING LIKE THIS EXAMPLE CAMERA PREVIEW FEED像这个示例相机预览提要
Firstly, get the image data.首先,获取图像数据。 This can be done by either using the
camera
plugin's output, or even directly communicate with the SurfaceView/TextureView.这可以通过使用
camera
插件的 output 来完成,甚至可以直接与 SurfaceView/TextureView 通信。
Secondly, run face detection algorithm.其次,运行人脸检测算法。 If you do not need cross-platform, https://medium.flutterdevs.com/face-detection-in-flutter-2af14455b90d?gi=f5ead7c6d7c9 MLKit sounds good.
如果不需要跨平台, https://medium.flutterdevs.com/face-detection-in-flutter-2af14455b90d?gi=f5ead7c6d7c9 MLKit 听起来不错。 If needing cross-platform, you can use Rust algorithms like https://github.com/atomashpolskiy/rustface and bind Rust code to Flutter via https://github.com/fzyzcjy/flutter_rust_bridge .
如果需要跨平台,可以使用Rust算法,如https://github.com/atomashpolskiy/rustface ,通过https://github.com/fzyzcjy/flutter_rust_bridge将Rust代码绑定到Flutter Or, use C++ face detection algorithms and bind to Flutter (though setup may be a bit harder).
或者,使用 C++ 面部检测算法并绑定到 Flutter(尽管设置可能有点困难)。
Lastly, once you know the face, draw a box around it.最后,一旦你知道了这张脸,就在它周围画一个方框。 For example,
Container
widget.例如,
Container
小部件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.