[Note] openCV + python

openCV + python

Memorandum code

test.py


import cv2

if __name__ == '__main__':
    capture_camera()

def capture_camera(mirror=True, size=None):
    """Capture video from camera"""
    cap = cv2.VideoCapture(0)
    while True:
        ret, frame = cap.read()
        if mirror is True:
            frame = frame[:,::-1]
        if size is not None and len(size) == 2:
            frame = cv2.resize(frame, size)
        cv2.imshow('camera capture', frame)
        k = cv2.waitKey(1)
        if k == 27:
            break
    cap.release()
    cv2.destroyAllWindows()

Recommended Posts

[Note] openCV + python
Note: Python
Python note
Note: Python Decorator
Python programming note
[Python] Learning Note 1
Python2.7 + CentOS7 + OpenCV3
Python study note_004
Python study note_003
Python beginner's note
python openCV installation (memo)
[Note] future sentence ~ Python ~
[Note] File reading ~ Python ~
Binarization with OpenCV / Python
Summary about Python3 + OpenCV3
Introduction to OpenCV (python)-(2)
OpenCV3 Python API list
Note to daemonize python
Note: python Skeleton Nya
Python basic grammar note (3)
Python OpenCV tutorial memo
Python, OpenCV camera capture
Python Tkinter Primer Note
OpenCV basic code (python)
OpenCV for Python beginners
Note
"Apple processing" with OpenCV3 + Python3
Python
Image editing with python OpenCV
Camera capture with Python + OpenCV
OpenCV3 installation for Python3 @macOS
Python Input Note in AtCoder
Note
Note
Make Opencv available in Python
[WIP] Fluent Python Study Note
Cascade classification machine [Note] [Opencv]
Face detection with Python + OpenCV
3 months note for starting Python
[AtCoder] ABC165C Personal Note [Python]
Using OpenCV with Python @Mac
Note that it supports Python 3
A note about [python] __debug__
Environment construction of python and opencv
Shining life with Python and OpenCV
Python Note: About comparison using is
[Python] Using OpenCV with Python (Image Filtering)
Neural network with OpenCV 3 and Python 3
[Note] Project Euler in Python (Problem 1-22)
[Python] Using OpenCV with Python (Image transformation)
Python: A Note About Classes 1 "Abstract"
Put python, numpy, opencv3 in ubuntu14
(Note) Be careful with python argparse
Easy Python + OpenCV programming with Canopy
[Note] Hello world output with python
boto3 (AWS SDK for Python) Note
Try face recognition with python + OpenCV
Cut out face with Python + OpenCV
Face recognition with camera with opencv3 + python2.7
Load gif images with Python + OpenCV
Foreign Key in Python SQLite [Note]