FOURCC is a four-byte code used to determine the encoding format of the video.A list of available encodings can be found from fourcc.org.#-*-coding:utf-8-*-ImportNumPy as NPImportCv2cap=Cv2. Videocapture (0) FourCC= Cv2. VIDEOWRITER_FOURCC (*'XVID') out= Cv2. Videowriter ('Test.avi', FourCC, 20.0, (640, 480)) whilecap.isopened (): RET, Frame=Cap.read ()ifRET = =True:frame=Cv2.flip (frame, 0) Out.write (frame) cv2.imshow ('Frame', frame)ifCv2.waitkey (1) 0xff = = Ord ('Q'): Break
To capture a video, you first create a Videocapture object.The parameter can be the index number of the device, or a video file.#-*-coding:utf-8-*-ImportNumPy as NPImportCv2cap=Cv2. Videocapture (0) whileTrue:ret, Frame=Cap.read () Gray=Cv2.cvtcolor (frame, cv2. Color_bgr2gray) Cv2.imshow ('Frame', Gray)ifCv2.waitkey (1) 0xff = = Ord ('Q'): Breakcap.release () cv2.destroyallwindows ( )Cap.read () returns a Boolean value. If the frame reads correctly, it is ture. Finally, you can check t
The rectangular border (bounding Rectangle) is said to wrap the found shape with a minimum rectangle. There is also a rectangle with a rotation, the area will be smaller, the effect seeOn the CodeFirst introduce the next Cv2.boundingrect (IMG) functionThis function is very simple, IMG is a binary graph, that is, its parameters;Returns four values, respectively, x,y,w,h;X, y is the coordinates of the top left of the matrix, W,h is the width and height of the matrixThen usecv2.rectangle(img, (x,y)
A python generates a sequence of random strings + writes to the picture fromPILImportImage,imagedraw,imagefontImportNumPy as NPImportRandomImportstringImportCv2#Generate random string forIinchRange (1,10000): Strnum= Random.randint (2,10) Ran_str="". Join (Random.sample (string.ascii_letters +string.digits, Strnum)) Font= Imagefont.truetype ('D:\MULTIMEDIA\ROSEWOODSTD-REGULAR.OTF', 60# OTF and TTF are all available. Image= Image.new ("RGB", (300, 20
standard Library, as well as binary forms of various platforms, can be obtained from the official Python website: https://www.python.org/free of charge, and you are free to spread these things.The site also contains suggestions from many people about the modules, programs, and tools that face Python 3, as well as a variety of additional documentation. The Python
Python quick tutorial and python tutorial
There is a quick python tutorial written by someone on the Internet, which is very good. It is much better than reading books. Click the link below
Http://www.douban.com/group/topic/30008
The index () method in Python is used in the tutorial, And the python tutorial is used in the tutorial.
The index () method determines the str string. If the start index beg and end index end give a substring to locate the string or string at the end. This method is the sam
Simple 10-minute Python getting started tutorial and python getting started tutorial
[Overview]
Python is a dynamic interpreted programming language. Python can be used on Windows, UNIX, MAC, and other operating systems, or on Jav
Python installation tutorial-Windows, python tutorial-windows
Before starting Python programming, you must first install the Python environment. You can download the Python installation
Image changes do not change the shape of the image. Image transformation is divided into three types: horizontal mirror, vertical mirror, diagonal image to set the size of the image is MXN, then the horizontal mirror can be by the formula I = IJ = n-j + 1 vertical mirror can be the formula I = m-i + 1J = J Diagonal Mirror can be by the formula I = m-i + 1J = n-j + 1 It is worth noting that the coordinates in OPENCV start from [0,0], so +1 of the formu
The Python quick tutorial is complete. I wrote a quick tutorial on Python over the past two years, and it finally took shape. This series of articles includes Python basics, standard libraries, and Django frameworks. The previous and later articles include the most important
developers speed up the development of Python and increase efficiency. An efficient code editor or IDE should provide features such as plugins, tools, etc. that can help developers develop efficiently. This article collects some of the best 10 Python for developers who are very helpful.
3. The top ten tricks can save Python developers time
Introduction:: This a
2017 latest Python tutorial and others Python tutorial
With the prevalence of Data Science, Python is more and more popular with programmers because it is easy to read and write. Python ranked first in the 2017 programming languag
Python getting started tutorial (2), python getting started tutorialMy life is so short that I play with snakes 0.0!
Python is an object-oriented, interpreted computer programming language, invented by Guido van rosum at the end of 1989, the first Public release was released on July 15, 1991. The
Basic python tutorial-simple branch and loop usage, basic python tutorial
This example describes the simple usage of python branches and loops. We will share this with you for your reference. The details are as follows:
Speaking of program design, we have to talk about seque
Multi-thread instance tutorial in python and python instance tutorial
This article describes in detail the usage of multiple threads in Python in the form of examples. It is widely used in Python programming. Share it with you for
Python is a simple getting started tutorial for data science and python getting started tutorial
Python has an extremely rich and stable data science tool environment. Unfortunately, for people not familiar with it, this environment is like a jungle (cue snake joke ). In thi
Basic knowledge of notes in the basic python tutorial and basic python tutorial
Digit-related
Add from _ future _ import division to the Python program, directly execute it in the interpreter, or use the command switch-Qnew when running
Python advanced tutorial: multiple transfer methods of function parameters, python advanced tutorial
We have been touched by the function parameter (arguments) transfer. At that time, we passed the corresponding parameters based on the location. We will be exposed to more parameter passing methods.
Recall location tran
Python class variable and member variable usage example tutorial, python instance tutorial
This article provides examples to illustrate the usage of class variables and member variables in python, which has some reference value for Pytho
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.