The following functions are often used , We can package it into a module , Use it to reduce the amount of code , Later, some common functions can also be put into this module
We can write one imutils.py file
#imutils.py import cv2 import numpy as np import matplotlib.pyplot as plt def
show(image): # display picture plt.imshow(image) plt.axis('off')# Axis is not displayed plt.show() def
imread(image): # Read picture image = cv2.imread(image) image = cv2.cvtColor(image,cv2.
COLOR_BGR2RGB) return image <> be careful :cv2.COLOR_BGR2RGB
cv2 The default is BGR order , and Matplotlib The library order is RGB, So conversion is needed

call imutils modular , Read stored in “D:/OpenCV image processing /” Picture below , In this case, Chinese can appear in the absolute path .
from imutils import * # Set working path import os # Import os modular os.chdir('D:/OpenCV image processing /')

Technology
©2019-2020 Toolsou All rights reserved,
Python Garbage collection and memory leak hive Summary of processing methods for a large number of small files The difference between memory overflow and memory leak , Causes and Solutions Create data mysql Library process You don't know ——HarmonyOS stay Vue Use in Web WorkerSparkSQL Achieve partition overlay write msf Generate Trojan horse attack android mobile phone Linux Page replacement algorithm C Language implementation Django Personal blog building tutorial --- Time classified archiving