9월, 2021의 게시물 표시

Brightness Histogram and Equalization

이미지
 Brightness histogram Brightness histogram is a graph showing the distribution of pixel values in an image. The horizontal axis is the pixel value (0 to 255), and the vertical axis is the number of pixels with the corresponding pixel value. Let's create a code that implements a brightness histogram. As you can see from the code below, matplolib must be installed in advance. First let's see one image named big-one.jpg import sys import numpy as np import cv2 from matplotlib import pyplot as plt, gridspec image = 'C:/lsh/study/image/big-one.jpg' im = cv2 . imread(image) B = im[:,:, 0 ] G = im[:,:, 1 ] R = im[:,:, 2 ] cv2 . imshow( "dark" , im) cv2 . waitKey( 0 ) cv2 . destroyAllWindows() This is the big-one.jpg image. Now let's implement the code that outputs the histogram of the image in earnest. The code is very simple. We will split the RGB image into R,G,B channels and then look at the pixel values per channel....