Example #1
0
 def surf_execution_finished(self, finished_thread):
     img = finished_thread.image
     descriptors = finished_thread.descriptors
     current_row = finished_thread.selected_indices[0]
     
     draw_features(img, descriptors)
     self.images_with_features[current_row] = img
     self.descriptors[current_row] = descriptors
     self.set_result(img)
     
     item = self.img_list.item(current_row)
     image_description = item.text()
     item.setText(image_description + self.trUtf8(u'\nFeatures: found'))
     self.show_msg_box(self.trUtf8(u'SURF Execution finished!'), 
         self.trUtf8(u'SURF algorithm execution finished for image:\n') + image_description)
     
     self.show_status(self.trUtf8(u'SURF method finished'))
Example #2
0
 def __detect_features(self):
     resp_layers = self.__responses
     for i in range(0, len(Surf.FILTER_MAP)):
         for j in range(1, 3):
             b = resp_layers[Surf.FILTER_MAP[i, j-1]]
             indM = Surf.FILTER_MAP[i, j]
             print '   Finding features of scale ' + str(Surf.SCALES[indM]) + '...'
             m = resp_layers[indM]
             t = resp_layers[Surf.FILTER_MAP[i, j+1]]
             for (x, y) in [(x, y) for x in range(1, m.width - 1) for y in range(1, m.height - 1)]:
                 if np.abs(m[y, x]) <= self.__thresh:
                     continue
                 is_max = True
                 for (dx, dy) in [(dx, dy) for dx in range(-1, 2) for dy in range(-1, 2)]:
                     if m[y, x] < max([b[y+dy, x+dx], m[y+dy, x+dx], t[y+dy, x+dx]]):
                         is_max = False
                         break
                 if is_max and self.__is_not_outlier(x, y, indM):
                     self.__features.append((x, y, indM, self.__traces[indM][y, x]))
     img = cv.CloneImage(self.__grayscale)
     from stitching.ui import cvdrawing
     cvdrawing.draw_features(img, self.__features, (1, 0, 0))
     cv.SaveImage('D:\\10.jpg', img)