Python - Espacio de color IHS

 
Vista:

Espacio de color IHS

Publicado por Geomata (21 intervenciones) el 12/01/2021 10:01:27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2
import numpy as np
import matplotlib.pyplot as plt
import skimage
from skimage import exposure
b1=plt.imread('B1Valencia.tif')
b2= plt.imread('B2Valencia.tif')
b3=plt.imread('B3Valencia.tif')
azul = b1[:,:,0]
verde =b2[:,:,0]
rojo =b3[:,:,0]
rgb =np.dstack((rojo,verde,azul))
plt.imshow(rgb)
#Transformación al espacio HSV
HSV = cv2.cvtColor(rgb,cv2.COLOR_RGB2HSV)
H=HSV[:,:,0]
S=HSV[:,:,1]
V=HSV[:,:,2]
Smin,Smax =np.percentile(rgb,(2,98))
S_str= exposure.rescale_intensity(S,in_range=(Smin,Smax))
HSV_strech = np.dstack((H,S_str,V))
#Transformaicón de vuelta al modelo RGB
RGB_str = cv2.cvtColor(HSV_strech,cv2.COLOR_HSV2RGB)
plt.imshow(RGB_str)
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder