Imutils
Contours
- imutils.contours.label_contour(image, c, i, color=(0, 255, 0), thickness=2)
- imutils.contours.sort_contours(cnts, method='left-to-right')
Convenience
- imutils.convenience.adjust_brightness_contrast(image, brightness=0.0, contrast=0.0)
Adjust the brightness and/or contrast of an image
- Parameters:
image – OpenCV BGR image
contrast – Float, contrast adjustment with 0 meaning no change
brightness – Float, brightness adjustment with 0 meaning no change
- imutils.convenience.auto_canny(image, sigma=0.33)
- imutils.convenience.build_montages(image_list, image_shape, montage_shape)
- imutils.convenience.check_opencv_version(major, lib=None)
- imutils.convenience.get_opencv_major_version(lib=None)
- imutils.convenience.grab_contours(cnts)
- imutils.convenience.is_cv2(or_better=False)
- imutils.convenience.is_cv3(or_better=False)
- imutils.convenience.is_cv4(or_better=False)
- imutils.convenience.opencv2matplotlib(image)
- imutils.convenience.resize(image, width=None, height=None, inter=3)
- imutils.convenience.rotate(image, angle, center=None, scale=1.0)
- imutils.convenience.rotate_bound(image, angle)
- imutils.convenience.skeletonize(image, size, structuring=0)
- imutils.convenience.translate(image, x, y)
- imutils.convenience.url_to_image(url, readFlag=1)
Encodigns
- imutils.encodings.base64_decode_array(a, dtype)
- imutils.encodings.base64_decode_image(a)
- imutils.encodings.base64_encode_array(a)
- imutils.encodings.base64_encode_image(a)
Meta
- imutils.meta.find_function(name, pretty_print=True, module=None)
Object Detection
- imutils.object_detection.non_max_suppression(boxes, probs=None, overlapThresh=0.3)
Paths
- imutils.paths.list_files(basePath, validExts=None, contains=None)
- imutils.paths.list_images(basePath, contains=None)
Perspective
Text
- imutils.text.put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8)
Utility for drawing vertically & horizontally centered text with line breaks
- Parameters:
img – Image.
text – Text string to be drawn.
font_face – Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_ITALIC to get the slanted letters.
font_scale – Font scale factor that is multiplied by the font-specific base size.
color – Text color.
thickness – Thickness of the lines used to draw a text.
line_type – Line type. See the line for details.
- Returns:
None; image is modified in place
- imutils.text.put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False)
Utility for drawing text with line breaks
- Parameters:
img – Image.
text – Text string to be drawn.
org – Bottom-left corner of the first line of the text string in the image.
font_face – Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_ITALIC to get the slanted letters.
font_scale – Font scale factor that is multiplied by the font-specific base size.
color – Text color.
thickness – Thickness of the lines used to draw a text.
line_type – Line type. See the line for details.
bottom_left_origin – When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.
- Returns:
None; image is modified in place