IP摄像机中的MTCNN_face_detection_alignment滞后,opencv cv2视频捕获帧矩阵背后的约定 [英] MTCNN_face_detection_alignment lagging in IP camera, Convention behind opencv cv2 videocapture frame matrix
问题描述
我只是试图从通过CV2 VideoCapture读取的帧中检测和识别面部.对于检测,使用Tensorflow实现的人脸检测/对齐算法位于 https://github.com/kpzhang93/MTCNN_face_detection_alignment .内置网络摄像头和通过USB连接的外部摄像头,MTCNN人脸检测过程没有延迟.但是,当它来自IP摄像机时,与检测算法相比就存在很大的滞后.与内置摄像机相比,该算法需要更多时间来处理ip摄像机中的单帧.诸如图像分辨率,图像细节之类的参数可能会产生影响.为了进一步理解它,希望了解除了分辨率和图像细节之外,所有参数都有哪些影响.
I am just trying to detect and recognize faces from the frame read through CV2 VideoCapture. For detection, using Tensorflow implementation of the face detection / alignment algorithm found at https://github.com/kpzhang93/MTCNN_face_detection_alignment. MTCNN Face detection process has no lag with builtin webcam and external camera connected with USB. However when it comes from IP camera there is a considerable lagging from detection algorithm. The algorithm takes more time to process single frame from ip camera than a frame from built in camera. Parameters like image resolution, image details can have a impact. To understand it further, looking to know what are all the parameters have impact other than resolution and image details.
内建网络摄像头和IP摄像头的带框框架矩阵值有所不同. Linux和Windows有所不同.帧矩阵值如何计算?定义帧矩阵值的参数有哪些?想知道如何使用Windows OS将内置网络摄像头的帧的帧矩阵值始终设置为0.
Noticed frame matrices value differs for builtin webcam and IP camera. It differs with linux vs windows. how the frame matrices values calculated? What are the parameters define a frame matrices value? Wondering how the frame matrix value always 0 for the frame from builtin webcam with windows OS.
内置摄像头(Windows)分辨率480.0 640.0.用python打印的框架矩阵
video_capture = cv2.VideoCapture(0)
ret, frame = video_capture.read()
print(frame)
.
Builtin webcam(Windows) resolution 480.0 640.0. Frame matrices printed in python
video_capture = cv2.VideoCapture(0)
ret, frame = video_capture.read()
print(frame)
.
[[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
...
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]
...
[0 0 0]
[0 0 0]
[0 0 0]]]
IP摄像机分辨率1080.0 1920.0.类似的方式,打印在IP摄像机的框架矩阵下方
IP camera resolution 1080.0 1920.0. Similar way, printed below the IP camera Frame matrices
[[[ 85 81 64]
[ 69 65 48]
[ 61 57 40]
...
[131 85 19]
[131 85 19]
[131 85 19]]
[[ 74 70 53]
[ 78 74 57]
[ 70 66 49]
...
[131 85 19]
[131 85 19]
[131 85 19]]
[[ 72 68 51]
[ 76 72 55]
[ 73 69 52]
...
[131 85 19]
[131 85 19]
[131 85 19]]
...
[[ 74 74 67]
[ 74 74 67]
[ 75 75 68]
...
[ 14 14 18]
[ 21 21 25]
[ 34 34 38]]
[[ 74 74 67]
[ 74 74 67]
[ 75 75 68]
...
[ 20 20 24]
[ 27 27 31]
[ 28 28 32]]
[[ 74 74 67]
[ 75 75 68]
[ 75 75 68]
...
[ 28 28 32]
[ 28 28 32]
[ 21 21 25]]]
推荐答案
由于某些技术原因,您的网络摄像头的前/后几行可能为空.您可以尝试为每行打印平均颜色,然后查看,结果可能会是这样:
Your web camera might have first / last few lines empty for some technical reason. You may try to print average colors for every line and see, probably it would end up something like this:
np.mean( frame, axis=(1,2) )
[ 0, 0, 34, 42, .... 75, 129, 0, 0 ]
这篇关于IP摄像机中的MTCNN_face_detection_alignment滞后,opencv cv2视频捕获帧矩阵背后的约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!