Definition of Histogram
Properties of Histograms
Only counting aThe number of gray-level occurrences of the imageIf the sizes are different, the number of times a pixel with a certain gray value appears isIt's not the same.
So if we build on thatDivided by the total number of pixels, that would beprobability that a particular gray level occurs, then in that caseGray scale histogram of the same content image of different sizesIt's the same.
Applications of Histograms
image enhancement
image segmentation
image recognition
Calculation of Python Histograms
import cv2 import numpy as np import as plt img = ('',0) img = () img = () myhist = [] for i in range(0,256): ((i)) ['-serif'] = ['SimHei'] # Used to display Chinese labels # [''] = 100 # Dots per inch () (x=range(0,256),height=myhist,width=0.5) ('Histogram') ("Grayscale values") ("Number of pixels") ()
Run the results graph:
Parameter settings.
import as plt ['-serif']=['SimHei'] # Used to display Chinese labels ['axes.unicode_minus']=False # Used to display the negative sign [''] = (16.0, 10.0) # Adjust the maximum size of the generated chart [''] = 300 # of dots per inch invocations()availablercParamsand the default values of all the parameters of the。 for example: '': 100.0 dots per inch '': [6.0, 4.0] Maximum size of generated charts '': 10.0 Font Size '': 10 Number of histogram bins '': 1.5 line width '': 'None' Marker styles '': 'png' Format for saving pictures 'savefig.jpeg_quality': 95 Image quality '': 'black' Text color 'timezone': 'UTC' time zone format
Above is the detailed content of Python Digital Image Processing Basic Histogram, more information about Python Digital Image Processing Basic Histogram please pay attention to my other related articles!