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.

Change image background

이미지
 In order to change the image background, it is important to distinguish the boundary between the person and the background well.  In YouTube broadcasting and TV broadcasting, the chroma key technique is used to accurately distinguish the boundary between the person and the background. Background removal using chroma key A chroma key is a technique used in film, video and still photography to replace a portion of an image with a new image. This is most commonly used to replaced a coloured background with a different setting.  The background color used for chroma key is usually blue or green. Persons who appear in the background of Chromakey must not wear clothes of the same color as Chromakey. If possible, wear complementary colors to accurately distinguish the boundary. <Chromakey example> Change chroma key photo background in OpenCV This task is very easy. For chroma key photos, the boundary line can be distinguished fairly accurately only with the OpenCV function. Convert chro