Tag:Grayscale image

  • Python numpy implementation of gray image segmentation and merging


    I don’t want to talk much nonsense. Let’s go straight to the code! from numpy import * import numpy as np import cv2, os, math, os.path from PIL import Image base=”F:\\Spy_CNN\\pythonCode\\cvSPY\\cvTest\\LBP\\LBPImag3\\” base2=”F:\\ProgrameCode\\FaceDataLib\\orl_Arry\\” imageOld=cv2.imread(base2+”s1_1.bmp”) image=cv2.cvtColor(imageOld,cv2.COLOR_BGR2GRAY) Synthesis of image H,W=image.shape#(112, 92) kuai=5 A = 1 # in order to adjust the program maskx,masky = H/kuai,W/kuai  #29 14 […]

  • Python opencv implementation of the array into gray and color images


    Main steps 1. Generate ordinary Python array (bytearray (), os.urandom ()) 2. Convert to numpy array( numpy.array ()) 3. Convert the array to the required dimension by reshape 4. Display in the form of image( cv.imshow ()) code import os import cv2 as cv import numpy as np # Make an array of 120000 random […]