355 views|1 replies

22

Posts

3

Resources
The OP
 

[DigiKey "Smart Manufacturing, Non-stop Happiness" Creative Competition] 4. Get webcam video stream with OpenCV [Copy link]

 

The video stream is provided by an ESP32-CAM development board. Through the web debugging tool, we can easily get the video stream address http://xxx.xxx.xxx.xxx:81/stream . The camera control is completed using the get method. For example, to set the video stream resolution, use get http://xxx.xxx.xxx.xxx/control?var=framesize&val=7 . Changing the number behind it can change the resolution. Currently, 7 corresponds to 800*480, which I think is moderate.

I wrote a class that can start the video stream with the following method:

```

 def stream_start(self, _size = None):

 if not _size:

 _size = self._size

 requests.get(self._url+"/control?var=framesize&val=" + str(_size))

 self._cap = cv2.VideoCapture(self._strem_url)



 def stream(self, _show = False, _save = False):

 self._cap.set(cv2.CAP_PROP_POS_FRAMES,-1)

 self._cap.grab()

 _capture = self._cap.retrieve()

 _capture

 if _save:

 cv2.imwrite("stream.jpg", _capture[1])

 if _show:

 cv2.imshow("stream", _capture[1])

 cv2.waitKey(1)

 return _capture

```

This post is from DigiKey Technology Zone

Latest reply

OpenCV gets the webcam video stream. This can be   Details Published on 2023-12-22 07:44
 
 

6570

Posts

0

Resources
2
 

OpenCV gets the webcam video stream. This can be

This post is from DigiKey Technology Zone
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list