White Balance and Maximum Color Method

Lassie ·
更新时间:2024-11-13
· 541 次阅读

 理论知识请移步这里

import cv2 as cv import numpy as np import sys assert 'linux' in sys.platform img = cv.imread('/home/image/Pictures/lena512color.jpg', 1) height = img.shape[0] width = img.shape[1] def maximumColorMethod(img): (B,G,R)=cv.split(img) Bmax=np.max(R) Gmax=np.max(G) Rmax=np.max(R) Sbgr=np.min([Bmax,Gmax,Rmax]) numB=numG=numR=0 for i in range(height): for j in range(width): if B[i,j]>Sbgr: numB+=1 if G[i,j]>Sbgr: numG+=1 if R[i,j]>Sbgr: numR+=1 Nmax=np.max([numB,numG,numR]) #print(numB,numG,numR) Bflatten=np.copy(B).flatten() Gflatten=np.copy(G).flatten() Rflatten=np.copy(R).flatten() #降序排序 Bflatten=-np.sort(-Bflatten,kind='quicksort') Gflatten=-np.sort(-Gflatten) Rflatten=-np.s 本文为VIP专属文章,单击开通VIP
作者:clock_t start,end;



AND method

需要 登录 后方可回复, 如果你还没有账号请 注册新账号
相关文章