Skip to content

camera module for python

rangerdawavs edited this page Nov 6, 2019 · 1 revision

camera module

documentation for custom module.

module code

description

this module simplifies the cv2 functions for controling cameras, windows, trackbars, and contours.

functions:

setup

starts a camera using height and width, then returns the setup to be used when calling other function, namely snap()

setup_sliders

starts the sliders using the starting positions provided

read_sliders

reads the current value of the sliders, and returns it as a array

snap

takes a photo and returns its data, which can then be used by other functions

show_img

creates a window and shows the picture it is given

show_mask

creates and shows a mask based on the picture it is given and slider values, returns the data of the mask to be used in other functions, such as find_contours

wait_for_exit

takes the character that is given and a time in milliseconds. waits a certain amount of time while checking for a key press, returns 1 if the the key related to the character is pressed, and 0 if it doesn't detect it

find_contours

returns a list of contours with their data, based on a mask

get_center

takes a contour and finds the middle of its bounding rectangle

show_contour

adds a contour to a frame and then shows it