简体   繁体   English

opencv imutils调整视频流大小

[英]opencv imutils resize videostream

I have a code that will resize the videostream using imutils 我有一个可以使用imutils调整视频流大小的代码

vStream = VideoStream(src=args["webcam"]).start()
frme = vStream.read()
frme = imutils.resize(frme, width=280)
gray = cv2.cvtColor(frme, cv2.COLOR_BGR2GRAY)

However it is maintaining the aspect ratio and because of that the face will become smaller and I may not be able to perform some videostream processing because I need the face to become closer to the camera. 但是,它保持了宽高比,因此人脸会变小,并且由于我需要人脸离相机更近而无法执行某些视频流处理。

Is there a way where size of the videostream has the width of 280 at the same time the face is closer to camera? 有没有办法使视频流的大小在人脸更靠近相机的同时具有280的宽度? .... zoom ? ....缩放? Crop? 作物?

In https://github.com/CJoseFlores/python-OpenCV-Zoom is code that uses imutils.resize() and cropping for zoom in a videostream ( grabbing frame from stream -> zooming -> display zoomed frames as stream ). https://github.com/CJoseFlores/python-OpenCV-Zoom中是使用imutils.resize()裁剪以放大视频流的代码(从流中抓取帧->缩放->将缩放的帧显示为流)。 Alternatively you can use cv.INTER_LINEAR() ( linear interpolation ) for zooming 或者,您可以使用cv.INTER_LINEAR()线性插值 )进行缩放

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM