2012-07-05 14 views

cevap

22

Bu sorun için cv2.convertScaleAbs kullanabilirsiniz. Aşağıdaki komut terminali demo dışarı Documentation.

Kontrolü Bkz:

>>> img = np.empty((100,100,1),dtype = np.uint16) 
>>> image = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR) 

>>> cvuint8 = cv2.convertScaleAbs(image) 

>>> cvuint8.dtype 
dtype('uint8') 

yardımcı olur Umut !!!

5

Bunu kullanmak öneririz:

outputImg8U = cv2.convertScaleAbs(inputImg16U, alpha=(255.0/65535.0)) 

bu irade çıkışı 0-65535

exemple : 
pixel with value == 65535 will output with value 255 
pixel with value == 1300 will output with value 5 etc... 
arasında orada önceki değere göre 0-255 arasında bir uint8 görüntü & atama değeri
İlgili konular