Ejemplo n.º 1
0
Archivo: main.py Proyecto: Enomiss/MSc
 def mousePressEvent(self, event):
     super(GraphicsScene, self).mousePressEvent(event)
     x = int(event.pos().x())
     y = int(event.pos().y())
     color = get_hsv( self.parent.piximage.matrix_o[y,x] )
     label = self.parent.piximage.get_label_name(x,y)
     print(x,y,color,label,self.parent.piximage.matrix_o[y,x])
Ejemplo n.º 2
0
def quantize(matrix):
    for j in range(0,len(matrix[0])):
        for i in range(0,len(matrix)):
            [h,s,v] = get_hsv(list(matrix[i][j]))
            
            if s != 0:
                if v > 10:
                    if s > 10:
                        if ((h >= 0) and (h < 30)) or ((h >= 330) and (h<360)):
                            matrix[i][j] = [255,0,0]
                        elif (h >= 30) and (h < 70):
                            matrix[i][j] = [255,255,0]
                        elif (h >= 70) and (h < 150):
                            matrix[i][j] = [0,255,0]
                        elif (h >= 150) and (h < 210):
                            matrix[i][j] = [0,255,255]
                        elif (h >= 210) and (h < 270):
                            matrix[i][j] = [0,0,255]
                        elif (h >= 270) and (h < 330):
                            matrix[i][j] = [255,0,255]
                    else:
                        if v < 30:
                            matrix[i][j] = [0,0,0]
                        elif v > 90:
                            matrix[i][j] = [255,255,255]
                        else:
                            matrix[i][j] = [128,128,128]
                else:
                    matrix[i][j] = [0,0,0]
            else:
                if v < 30:
                    matrix[i][j] = [0,0,0]
                elif v > 90:
                    matrix[i][j] = [255,255,255]
                else:
                    matrix[i][j] = [128,128,128]
            
                
    return(matrix)