Opencv视频源在第一帧停止

时间:2016-01-08 17:41:44

标签: android opencv video webcam

我正在尝试使用IP网络摄像头和opencv通过我的Android手机的相机获取视频。我使用的是带有opencv 3.1.0的python 3.5(anaconda发行版)以下是代码:

import cv2
import numpy as np

cap = cv2.VideoCapture(0)
cap.open('http://192.168.1.4:8080/video')
while True:
    ret, frame = cap.read()
    cv2.imshow('RGB output', frame)
    if cv2.waitKey(0):
        break
cap.release()
cv2.destroyAllWindows()

问题是,当我运行脚本时,我只能看到第一帧而不是常量视频源。我搜索了很多,但找不到解决方案。救命啊!

1 个答案:

答案 0 :(得分:0)

<?php

$connection = mysqli_connect('localhost','root','','rohit');
{

$query  = "SELECT * FROM user";
$result = mysqli_query($connection,$query);

while($row = mysqli_fetch_assoc($result)) {
    $id     = $row['id'];
    $name   = $row['name'];
    $lname  = $row['lname'];
    $dept   = $row['department'];
    $dob    = $row['DOB'];
    $doj    = $row['DOJ'];
    $mobile = $row['mobile'];
    $email  = $row['email'];
    $salary = $row['salary'];
    $gender = $row['gender'];


    echo "<tr>";
    echo "<td>{$id}</td>";
    echo "<td>{$name}</td>";
    echo "<td>{$lname}</td>";
    echo "<td>{$dept}</td>";
    echo "<td>{$dob}</td>";
    echo "<td>{$doj}</td>";
    echo "<td>{$mobile}</td>";
    echo "<td>{$email}</td>";
    echo "<td>{$salary}</td>";
    echo "<td>{$gender}</td>";
    echo '<td>' . '<form method="post"><button class="mb-1 mr-1 btn btn-primary" name="edit"><i class="fa fa-edit"></i></button>' .
        '<input type="hidden" name="del_id" value="'.$id.'">'.
        '<button class="mb-1 mr-1 btn btn-danger" name="delete"><i class="fa fa-times"></i></button></form>'
        . '</td>';
    echo "</tr>";

}
}

?>
<?php
if (isset($_POST['delete'])) {
$del_id = $_POST['del_id'];
$query1  = "DELETE FROM user ";
$query1 .= "WHERE id = $del_id LIMIT 1";
$result1 = mysqli_query($connection,$query1);

if (!$result1) {
    die("FAILED" . mysqli_error($connection));
}
}
?>

尝试上面的代码就可以了。