Comments (6)
The failing command is ofc plt.imshow(frame)
from pedestrian-cam.
Hi @turbo , I am unable to recreate this bug-- I wrote this using Python 3.6 and OpenCV 3.3.0, can you check to make sure you have the right versions?
from pedestrian-cam.
This seems to be a very widely known issue: ContinuumIO/anaconda-issues#121
None of the workarounds work for me though.
from pedestrian-cam.
Hmm. I installed OpenCV 3.3 using Conda Forge. I think this may have helped me avoid those issues.
from pedestrian-cam.
Even with Conda Forge OpenCV, the stream loading fails:
OpenCV: Couldn't read video stream from file "http://192.65.213.243/mjpg/video.mjpg"
So I used this minimal mjpeg frame proxy (PHP):
<?php
header("Access-Control-Allow-Origin: *");
function mjpeg_grab_frame($url) {
$f = fopen($url, 'r');
if($f) {
$r = null;
while(substr_count($r, "\xFF\xD8") != 2) $r .= fread($f, 512);
$start = strpos($r, "\xFF\xD8");
$end = strpos($r, "\xFF\xD9", $start)+2;
$frame = substr($r, $start, $end-$start);
fclose($f);
return $frame;
}
}
header("Content-type: image/jpeg");
die(mjpeg_grab_frame($_REQUEST['src']));
Started with php -S localhost:8000
. Then this will work:
URL = 'http://localhost:8000/?src=http://192.65.213.243/mjpg/video.mjpg'
# Test capturing a frame from mJPG
cap = cv2.VideoCapture(URL)
ret, frame = cap.read()
from pedestrian-cam.
Wow, clever solution! I'll keep an eye out for this problem in the future, should I encounter it.
from pedestrian-cam.
Related Issues (5)
- Can you add a license? HOT 1
- Live CCTV HOT 2
- Approach to collect data HOT 3
- Issue running server.py HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pedestrian-cam.