fourcc

How to write on video with cv2 AND MTCNN? I'm facing problems with fourcc

安稳与你 提交于 2020-12-12 04:48:08
问题 I'm trying to write a script that anonymized faces on videos. here is my code (python): import cv2 from mtcnn.mtcnn import MTCNN ksize = (101, 101) def decode_fourcc(cc): return "".join([chr((int(cc) >> 8 * i) & 0xFF) for i in range(4)]) def find_face_MTCNN(color, result_list): for result in result_list: x, y, w, h = result['box'] roi = color[y:y+h, x:x+w] cv2.rectangle(color, (x, y), (x+w, y+h), (0, 155, 255), 5) detectedFace = cv2.GaussianBlur(roi, ksize, 0) color[y:y+h, x:x+w] =

How to write on video with cv2 AND MTCNN? I'm facing problems with fourcc

*爱你&永不变心* 提交于 2020-12-12 04:47:21
问题 I'm trying to write a script that anonymized faces on videos. here is my code (python): import cv2 from mtcnn.mtcnn import MTCNN ksize = (101, 101) def decode_fourcc(cc): return "".join([chr((int(cc) >> 8 * i) & 0xFF) for i in range(4)]) def find_face_MTCNN(color, result_list): for result in result_list: x, y, w, h = result['box'] roi = color[y:y+h, x:x+w] cv2.rectangle(color, (x, y), (x+w, y+h), (0, 155, 255), 5) detectedFace = cv2.GaussianBlur(roi, ksize, 0) color[y:y+h, x:x+w] =

OpenCV write frame to file python

…衆ロ難τιáo~ 提交于 2019-12-11 05:05:14
问题 Hey so im starting to play around with OpenCV and I cant get my webcam output saved to a file. Here is what I have. This runs fine, launches the webcam and creates "output.avi" The issue is output.avi is tiny(414 bytes) and the same exact bytes each time I run the program. Im guessing the issue is with the fourcc encoding but I havent been able to find what works in my case. I am running on Mac OS X. Let me know if you need anymore information. import numpy as np import cv2 path = ('/full

Set a FourCC value in C++

蓝咒 提交于 2019-12-05 08:41:41
I want to set a FourCC value in C++, i.e. an unsigned 4 byte integer. I suppose the obvious way is a #define, e.g. #define FOURCC(a,b,c,d) ( (uint32) (((d)<<24) | ((c)<<16) | ((b)<<8) | (a)) ) and then: uint32 id( FOURCC('b','l','a','h') ); What is the most elegant way you can think to do this? You can make it a compile-time constant using: template <int a, int b, int c, int d> struct FourCC { static const unsigned int value = (((((d << 8) | c) << 8) | b) << 8) | a; }; unsigned int id(FourCC<'a', 'b', 'c', 'd'>::value); With a little extra effort, you can make it check at compile time that