示例#1
0
    def Detectar(self):
        if self.dataSet is None:
            return

        #Lo que agregó matias
        AS = 170
        AL = 110
        DD = np.copy(self.dataSet)
        DD = retro.QuitarDatos(DD, AS, AL)
        #Metodo K-MEANS
        if self.Lista_Algoritmos.currentText() == "K-Means":

            #Inicio de la deteccion
            self.Label_Deteccion.setStyleSheet("*{color:red;}")
            self.Label_Deteccion.setText("Detectando " + str(self.k.value()) +
                                         " Objetos...")
            self.Label_Deteccion.repaint()

            k = int(self.k.value())
            TN, chch = conversion.kk(DD, k)
            #Fin de la deteccion
            self.Label_Deteccion.setText("Deteccion")
            self.Label_Deteccion.setStyleSheet("*{color:#555;}")
            try:
                self.sc2.ImprimirOBjetos(self.dataSet, TN, chch, 1, 0)
            except:
                QMessageBox.critical(self, 'Erorre', "   Erore Plot")

        #Metodo DBSCAN
        if self.Lista_Algoritmos.currentText() == "DBSCAN":
            #Inicio de la deteccion
            self.Label_Deteccion.setStyleSheet("*{color:red;}")
            self.Label_Deteccion.setText("Detectando...")
            self.Label_Deteccion.repaint()

            Epsilon = 40  #35 #30
            MinPts = 20  #40 #75 #78
            chch = conversion.RObjetos(DD, Epsilon, MinPts)
            TN = conversion.usar(chch)
            #Fin de la deteccion
            self.Label_Deteccion.setText("Deteccion")
            self.Label_Deteccion.setStyleSheet("*{color:#555;}")
            try:
                self.sc2.ImprimirOBjetos(self.dataSet, TN, chch, 1, 0)
            except:
                QMessageBox.critical(self, 'Erorre', "   Erore Plot")
        #ACTUALIZACION MOTORES
        b = int(self.comboBox.currentIndex())
        rci = int(self.dim_min.value())
        rce = int(self.dim_max.value())
        print(f"Indice {b}")
        Porcentajes = retro.vec_retro(
            TN, chch, b, rci,
            rce)  #b --> Metodo detecion arg(TN,chch,metodo=0,rci,rce)
        #Envio de respuesta a motores
        thread1 = retro.PWM1(Porcentajes)
        thread1.start()
        self.Desplegar_Retroalimentacion(Porcentajes)
        return
示例#2
0
import matplotlib.pyplot as plt
import random
import math
from mpl_toolkits.mplot3d import Axes3D
# import open3d as o3d

# %matplotlib inline
D = conversion.txt2array()

DD = np.copy(D) # Creamos copia de datos para no afectar a los originales

Epsilon = 30
MinPts = 75 #78
# result = DBSCAN(DD,Epsilon,MinPts)

chch = conversion.RObjetos(DD,Epsilon,MinPts)

TN = conversion.usar(chch)

# Graficar un dato
conversion.imprimir3D(D)
# conversion.imprimir3D(DD)

# Imprimir sin ruido--- graficar
conversion.imprimirObjetos(TN,chch,0,0) 
# Graficar con ruido
conversion.imprimirObjetos(TN,chch,1,0)

# conversion.imprimirObjetos(TN,chch,2,1)
# (Objetos,tamañoobjetos,2,cualObjeto)