![]() ![]() If ((infile = fopen(filename, "r")) != NULL)įscanf (infile, "%d %d", &xsize, &ysize) Int get_image (char *filename, int im, int *xsize, int *ysize) Int image, histogram, xsize, ysize, file_ok įile_ok = get_image (filename, image, &xsize, &ysize) įind_histogram (image, xsize, ysize, histogram) this is for “bin” or we can call “brackets” so you can read more about bin here. If you want to choose the frame, you need to made it before but in this article I didn’t do that. None - this is for select point of the picture that you want to calculate. in case of color image is for blue, for green and for red. channel color of histogram chose if your image is in gray scale. Hist = cv2.calcHist(,none,) plt.subplot(121), plt.imshow(jpg, 'gray') plt.subplot(122), plt.plot(Hist) plt.xlim() ![]() Then we will using calcHist function from openCV and plot it by using matplotlib for comparing between picture and graph. ![]() The number after file name is to select type of image.ġ for load image in color 0 for load image in gray scale -1 for load image that include alpha channel in pixel values This code is for reading your image files. You can check version by using this code cv2._version_ Calculate and plot jpg = cv2.imread('image.jpg',0) In this article I using OpenCV version 3.4.3. import cv2 from matplotlib import pyplot as plt First is openCV for using function “calcHist” and second is matplot for plotting the histogram. Next, we need to import library that will use in calculating histogram. Then your files in google drive will appear on your left side same as uploaded files. from lab import drive drive.mount('/content/drive') ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |