安装了python 2.7和opoencv 3.1。尝试运行在线找到的示例代码。我可以使用imshow以灰色方式查看每个帧,但VLC无法打开或播放输出灰度级视频。
当我用out.write(frame)替换out.write(gray_image)来保存原始颜色帧时,输出视频是输入视频的一个很好的副本。我不明白为什么无法正确保存灰度级帧。
new SecondClass()
答案 0 :(得分:0)
您没有将<form action="subscribe.php" class="subscribe" id="subscribe" method="post">
<input type="email" placeholder="Enter your email" class="email form_item requiredField" name="subscribe_email" required />
<!--
if you need to use ajax then this should be changed to a standard `button` and a suitable
javascript listener attached either inline or on pageload in the head.
-->
<input type="submit" class='form_submit' value="subscribe" />
<div id="form_results"></div>
</form>
<?php
$useajax=false;/* set as true to use ajax once form & javascript are setup */
$email=false;
if( $_SERVER['REQUEST_METHOD']=='POST' ) {
$to_email = "rest@gmail.com";
$name = 'Rest';
$messages=(object)array(
'method' => array( 'type' => 'error', 'text' => 'Sorry, Request must be Ajax POST' ),
'success' => array( 'type' => 'message', 'text' => 'Thank you. Your email was sent successfully.' ),
'failed' => array( 'type' => 'error', 'text' => 'Could not send mail! Please check your PHP mail configuration.' )
);
if( $useajax ) {
if( !isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) != 'xmlhttprequest' ) {
exit( json_encode( $messages->method ) );
}
}
$email = filter_var( filter_input( INPUT_POST, 'subscribe_email', FILTER_SANITIZE_EMAIL ), FILTER_VALIDATE_EMAIL );
if( $email ){
$headers = "From: {$name}
Reply-To: {$email}
X-Mailer: PHP/" . phpversion();
$subject = 'New subscriber';
$message = 'You have a new subscriber '.$email;
$result = @mail( $to_email, $subject, $message , $headers );
}
$output=$result ? $messages->success : $messages->failed;
exit( json_encode( $output ) );
}
?>
参数设置为isColor
VideoWriter构造函数
Python:cv2.VideoWriter([filename,fourcc,fps,frameSize [, isColor ]])
False
库,有时无法正确创建灰色视频。