1. 程式人生 > >python3 opencv獲取視訊的總幀數介紹

python3 opencv獲取視訊的總幀數介紹

import cv2

cap=cv2.VideoCapture(path)

frames_num=cap.get(7)#get方法引數按順序對應下表(從0開始編號,比如這裡為了獲取視訊的總幀數,在下表是排第八個的
CV_CAP_PROP_FRAME_COUNT



propId –

Property identifier. It can be one of the following:

  • CV_CAP_PROP_POS_MSEC Current position of the video file in milliseconds or video capture timestamp.
  • CV_CAP_PROP_POS_FRAMES
     0-based index of the frame to be decoded/captured next.
  • CV_CAP_PROP_POS_AVI_RATIO Relative position of the video file: 0 - start of the film, 1 - end of the film.
  • CV_CAP_PROP_FRAME_WIDTH Width of the frames in the video stream.
  • CV_CAP_PROP_FRAME_HEIGHT Height of the frames in the video stream.
  • CV_CAP_PROP_FPS
     Frame rate.
  • CV_CAP_PROP_FOURCC 4-character code of codec.
  • CV_CAP_PROP_FRAME_COUNT Number of frames in the video file.
  • CV_CAP_PROP_FORMAT Format of the Mat objects returned by retrieve() .
  • CV_CAP_PROP_MODE Backend-specific value indicating the current capture mode.
  • CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras).
  • CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras).
  • CV_CAP_PROP_SATURATION Saturation of the image (only for cameras).
  • CV_CAP_PROP_HUE Hue of the image (only for cameras).
  • CV_CAP_PROP_GAIN Gain of the image (only for cameras).
  • CV_CAP_PROP_EXPOSURE Exposure (only for cameras).
  • CV_CAP_PROP_CONVERT_RGB Boolean flags indicating whether images should be converted to RGB.
  • CV_CAP_PROP_WHITE_BALANCE_U The U value of the whitebalance setting (note: only supported by DC1394 v 2.x backend currently)
  • CV_CAP_PROP_WHITE_BALANCE_V The V value of the whitebalance setting (note: only supported by DC1394 v 2.x backend currently)
  • CV_CAP_PROP_RECTIFICATION Rectification flag for stereo cameras (note: only supported by DC1394 v 2.x backend currently)
  • CV_CAP_PROP_ISO_SPEED The ISO speed of the camera (note: only supported by DC1394 v 2.x backend currently)
  • CV_CAP_PROP_BUFFERSIZE Amount of frames stored in internal buffer memory (note: only supported by DC1394 v 2.x backend currently)

相關推薦

python3 opencv獲取視訊介紹

import cv2cap=cv2.VideoCapture(path)frames_num=cap.get(7)#get方法引數按順序對應下表(從0開始編號,比如這裡為了獲取視訊的總幀數,在下表是排第八個的CV_CAP_PROP_FRAME_COUNTpropId –Pro

日記與疑惑:關於opencv設定視訊間隔

使用python3.6,opencv3.3.1在64位win10下執行,使用capture.get(cv2.CAP_PROP_POS_FRAMES)得到當前幀數,使用capture.set(cv2.CAP_PROP_POS_FRAMES, position)得到後面一幀,這

《隨堂小記》 OPENCV+獲取視訊中某一的影象並儲存

配置: opencv3.2 VS2017 Windows10 2.程式碼部分 // GetApictureOfVideos.cpp : 定義控制檯應用程式的入口點。 // #includ

python3 requests 獲取 拉勾工作

.post ict web data cit industry utf-8 wow64 first 1 #-*- coding:utf-8 -*- 2 __author__ = "carry" 3 4 import requests,json 5 6 fo

檔案上傳至oss後,獲取圖片縮率圖、獲取視訊等後續操作

上一篇文章說了一下檔案上傳至oss:https://blog.csdn.net/new_programmer_h/article/details/84307005 這裡說一下上傳後的一些後續操作:常用的獲取圖片縮率圖、獲取視訊截幀生成封面圖。自我感覺阿里oss對於這些處理封裝的很好,只要根據:"%s|sys

OpenCV獲取視訊檔案基本資訊

import cv2 cameraCapture = cv2.VideoCapture('./res/test.mp4') print(cameraCapture.get(cv2.CAP_PROP_POS_MSEC)) print(cameraCapture

windows下PHP獲取視訊第一圖片作為背景圖

我在網上找了很多這方面的資料,總結如下:一般用ffmpeg獲取視訊第一幀圖片作為背景圖; ffmpeg的下載連結  http://ffmpeg.org/download.html ; 下載好包,包裡面在

C#下獲取當前毫秒的方法和程式碼

在.Net下DateTime.Ticks獲得的是個long型的時間整數,具體表示是至0001 年 1 月 1 日午夜 12:00:00 以來所經過時間以100納秒的數字。轉換為秒為Ticks/1000

android獲取圖片原始長寬,獲取視訊第一的縮圖

public static Bitmap getVideoThumbnail(String videoPath) { MediaMetadataRetriever media =new MediaMetadataRetriever(); media.setDataSource(videoPat

opencv處理視訊

本專案採用opencv將視訊分幀為圖片,將圖片輸入到已訓練好的模型,得到標註出車輛和行人的圖片,再經opencv合幀為視訊輸出。在學習.cpp對視訊的分幀合幀的過程中留下此說明文件。examples/ssd/下有一ssd_detect_t3_voc0712.cpp檔案,是對專

Android之使用MediaMetadataRetriever類獲取視訊第一

一.首先,來介紹一下MediaMetadataRetriever類,此類位於android.media包下,這裡,先附上可檢視此類的API地址:MediaMetadataRetriever類,大家可以自行檢視。 1.MediaMetadataRetriever類概述:Med

Android 獲取視訊第一縮圖

乾貨 從API 8開始,新增了一個類: android.media.ThumbnailUtils這個類提供了3個靜態方法一個用來獲取視訊第一幀得到的Bitmap,2個對圖片進行縮略處理。 public static Bitmap createVideoThumbna

Android -- 獲取視訊第一縮圖

從API 8開始,新增了一個類: android.media.ThumbnailUtils這個類提供了3個靜態方法一個用來獲取視訊第一幀得到的Bitmap,2個對圖片進行縮略處理。 public static Bitmap createVideoThumbnail (

Java獲取視訊第一做縮圖

Java使用FFmpeg獲取視訊的縮圖 ffmpegPath為FFmpeg.exe所在路徑 upFilePath為視訊的所在路徑(本地路徑) mediaPicPath為縮圖的儲存路徑(D:/test.jpg) private void handler(String ffm

js獲取 gif 的

hang eat end minimum ade device 獲取 mini highlight 使用 javascript 獲取 GIF 圖的幀數,如果幀數過大,則不讓傳到服務器 這裏是使用一個插件: github地址為: https://github.com/buz

OpenCV 讀取視訊,設定起始、結束及如何獲取

//讀取視訊 VideoCapture capture(“1.avi”); if (!capture.isOpened()) { return 0; } long totalFrameNumber=capture.get(CV_CAP_PROP_FRAME_COUNT);//獲取視訊的總幀數 c

機器視覺 OpenCV—python 影象資料集獲取工具(視訊

一、前言 之前在做影象分類的時候,人臉識別(開原始碼)的練手,資料集獲取麻煩(沒人願意將自己照片給人家做資料集),於是就用自己造資料集,但是拍照拍幾百張訓練效果不好,也嫌麻煩,乾脆就是視訊取幀的方式,在這之前使用專門的軟體。不過opencv自帶了視訊處理的API

分頁總數計算,根據記錄獲取分頁總數_目標科技

感覺 math ceiling double 分頁 total str 計算 tro 分頁總數計算,根據總記錄數獲取分頁總數,本文章提供5種寫法,大家感覺哪個好用就拿去用吧。 int pageSize = 20; //每頁記錄數量 int total

Python3.x:訪問帶參鏈接並且獲取返回json串

ada utf callback ear live from python3 mini body Python3.x:訪問帶參數鏈接並且獲取返回json串 核心代碼: import json import xml.dom.minidom from urllib impor

C二維字符組的使用及如何獲取二維組的總行

body RR blog 行指針 AR true int arr pre #include <stdio.h> #include <stdlib.h> int main(){ char str[][30] = {"zhangsan","lisi"