Ejemplo n.º 1
0
 def targets(self):
     targets = []
     for i, rivi in enumerate(self.rivit):
         
         if rivi["Target"] != '' and rivi["Cq"] != 'NaN':
             found = False
             for target in targets:
                 
                 if target.compare(rivi["Target"], self.tiedostot[i]) is True:
                     target.add_str_cq(rivi["Cq"])
                     found = True
             
             if found is False:
                 t = TargetData(rivi["Target"], self.tiedostot[i], self.tiedoston_numero(self.tiedostot[i]))
                 t.add_str_cq(rivi["Cq"])
                 targets.append(t)
         
     return targets
Ejemplo n.º 2
0
    def __init__(self, networkTable):
        """initializes all values to presets or None if need to be set
        """
        self.targetData = TargetData()
        self.networkTable = networkTable
        
        self.__resize_image_width = 320.0
        self.__resize_image_height = 240.0
        self.__resize_image_interpolation = cv2.INTER_CUBIC

        self.resize_image_output = None

        self.__hsl_threshold_input = self.resize_image_output
        self.__hsl_threshold_hue = [51.798561151079134, 93.99317406143345]
        self.__hsl_threshold_saturation = [71.08812949640287, 255.0]
        self.__hsl_threshold_luminance = [36.690647482014384, 255.0]

        self.hsl_threshold_output = None

        self.__find_contours_input = self.hsl_threshold_output
        self.__find_contours_external_only = True

        self.find_contours_output = None

        self.__filter_contours_contours = self.find_contours_output
        self.__filter_contours_min_area = 20.0
        self.__filter_contours_min_perimeter = 0.0
        self.__filter_contours_min_width = 0.0
        self.__filter_contours_max_width = 1000.0
        self.__filter_contours_min_height = 0.0
        self.__filter_contours_max_height = 1000.0
        self.__filter_contours_solidity = [0, 100]
        self.__filter_contours_max_vertices = 1000000.0
        self.__filter_contours_min_vertices = 0.0
        self.__filter_contours_min_ratio = 0.0
        self.__filter_contours_max_ratio = 1000.0

        self.filter_contours_output = None
        
        self.lastCenterX = float('NaN')
        self.lastCenterY = float('NaN')
        self.lastDistance_inches = float('NaN')
        self.lastCenter_deg = float('NaN')
Ejemplo n.º 3
0
 def group_ct_mean(self, bees):
     target_means = {}
     
     for bee in bees:
         targets = self.ct_means(bee.targets())
         
         for target in targets:
             if target.ct_mean != 0:
                 if target.name in target_means:
                     target_means[target.name].add_cq(target.ct_mean)
                 else:
                     t = TargetData(target.name)
                     t.add_cq(target.ct_mean)
                     target_means[target.name] = t
     
     for target in target_means:
         t = target_means[target]
         t.ct_mean = self.count_mean(t.cq_list)
         t.standard_deviation = self.count_standard_deviation(t.cq_list)
         
     return target_means