Posts

Showing posts from October, 2017

OpenCv Python Image process: Image

cv2.imread() , cv2.imshow() , cv2.imwrite() Second argument is a flag which specifies the way image should be read. cv2.IMREAD_COLOR : Loads a color image. Any transparency of image will be neglected. It is the default flag. cv2.IMREAD_GRAYSCALE : Loads image in grayscale mode cv2.IMREAD_UNCHANGED : Loads image as such including alpha channel import numpy as np import cv2 # Load an color image in grayscale img = cv2 . imread ( 'messi5.jpg' , 0 ) cv2 . imshow ( 'image' , img ) cv2 . waitKey ( 0 ) cv2 . destroyAllWindows () http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_image_display/py_image_display.html

OpenCv Python Image process: Video Capture

To capture a video, you need to create a VideoCapture object cap.read() returns a bool (True/False). cap.isOpened() . If it is True, OK. Otherwise open it using cap.open() . cap.get(propId) frame = cv2 . flip ( frame , 0 ) http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture-get http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_image_display/py_image_display.html http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_image_display/py_image_display.html import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True):     # Capture frame-by-frame     ret, frame = cap.read()     # Our operations on the frame come here     gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)     # Display the resulting frame     cv2.imshow('frame',gray)     if cv2.waitKey(1) & 0xFF == ord('q'):   ...

Opencv Python Image processing: Image show example

import cv2 import numpy as np path = 'C:\Users\mvish\Pictures\Logitech Webcam\Picture 5.jpg' img  = cv2.imread(path,0) cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows()

Opencv Python

http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_setup/py_intro/py_intro.html#intro http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html Numpy: http://scipy.github.io/old-wiki/pages/Numpy_Example_List