Example #1
0
 def __init__(self,condition='light'):
     self.condition=condition
     self.picture_path='./pictures/'+condition+'/'
     self.label_name='./labels/'+condition+'_label.npy'
     self.feature_file='./labels/'+condition+'_labels.csv'
     # self.counter=0
     self.img_reader=ImgReader(self.picture_path,self.label_name)
     self.cube=CubeBase()
     self.color_reader=ColorReader(self.feature_file)
     self.verifier=ValidateClass()
Example #2
0
class Controller():
    def __init__(self, condition='light'):
        self.condition = condition
        self.picture_path = './pictures/' + condition + '/'
        self.label_name = './labels/' + condition + '_label.npy'
        self.feature_file = './labels/' + condition + '_labels.csv'
        self.center_file = './labels/' + condition + '_center.npy'
        # self.counter=0
        self.img_reader = ImgReader(self.picture_path, self.label_name)
        self.center = CenterReader(self.center_file)
        self.cube = CubeBase()
        self.color_reader = ColorReader(self.feature_file)
        self.verifier = ValidateClass()

    def run(self, maxgroup=11):
        for i in range(maxgroup):
            # print("group:",i)
            img = self.img_reader.update(i)
            center = self.center.getCenter(i)
            # print(center)
            # result=self.cube.onlineUpdate(img,center)
            result = self.cube.test(img)
            self.color_reader.update(i)
            self.verifier.validate(i, result, self.color_reader.cur_labels)
        print("dataset:", self.condition)
        self.verifier.showResult(isALL=False)
Example #3
0
import numpy as np
import cv2

from Classes import ImgReader, CubeBase, ValidateClass, ColorReader

condition = 'light'
picture_path = './pictures/' + condition + '/'
label_name = './labels/' + condition + '_label.npy'
feature_file = './labels/' + condition + '_feature.csv'
# cv2.namedWindow("img")
counter = 0
#img_reader
img_reader = ImgReader(picture_path, label_name)
img = img_reader.update(counter)
#cube
cube = CubeBase()
result = cube.test(img)
result_img = cube.drawResult()
#color_reader
color_reader = ColorReader(feature_file)
color_img = color_reader.update()
#Verifier
verifier = ValidateClass()
verifier.validate(counter, result, color_reader.labels)
verifier.showResult()
counter += 1
cv2.imshow('img', img)
cv2.imshow('result', result_img)

while True:
    key = cv2.waitKey(1)