def shoot_panorama(camera, motors, shots=5):
    s = 1
    im = IMR.ImageManager(image=camera.update()).scale(s, s)
    rotation_time = 3 / shots  # At a speed of 0.5(of max), it takes about 3 seconds to rotate 360 degrees
    for i in range(shots - 1):
        motors.right(0.5, rotation_time)
        im = im.concat_horiz(IMR.ImageManager(image=camera.update()))
    return im
예제 #2
0
 def __init__(self, master=None):
     """ Initialize main variables which will be used throughout the program.
     """
     super().__init__(master)
     self.master = master
     #self.load_state()
     self.filename = filedialog.askopenfilename()
     #self.id = "default" # ID of the current opened document.
     self.id = self.filename.split('/')[-1][:-4]
     self.page_number = 1  # Which page is user reading?
     self.last_visited_page = 1
     self.zoom_rate = 1
     self.img_x = 0  # Horizontal length of image
     self.img_y = 0  # Vertical length of image
     self.cards = card_manager.CardManager(
         self)  # Ancillary class to add cards to document.
     self.anki = anki.Anki()
     self.image_manager = image_manager.ImageManager(self)
     self.create_widgets()
예제 #3
0
 def setUp(self):
     self.image_manager = image_manager.ImageManager()
     self.image_surface = 'IMAGE_SURFACE'
     self.image_filepath = 'IMAGE_FILEPATH'
     self.image_id = 'IMAGE_ID'
예제 #4
0
print("Output shape after merge:", final_model.output_shape)
final_model.add(Dense(128))
final_model.add(Activation('relu'))
print("Output shape after dully connected:", final_model.output_shape)
final_model.add(Dense(nb_classes))
final_model.add(Activation('softmax'))
print("Output shape after softmax (2 classes):", final_model.output_shape)

#train_data partition
brains = [
    "tka002", "tka003", "tka004", "tka005", "tka006", "tka007", "tka009",
    "tka010", "tka011", "tka012", "tka013", "tka015", "tka016", "tka017",
    "tka018", "tka019", "tka020", "tka021"
]

tr = imm.ImageManager()  # load training data
res = []


def evaluate(model, X_test, y_test):
    y_pred = model.predict(X_test)
    mat = [[0, 0], [0, 0]]  # [[TP,FP],[FN,TN]]
    for i in range(len(y_pred)):
        if y_test[i][1] == 0:  # real negative
            mat[1][1] += y_pred[i][0]  #TN
            mat[0][1] += y_pred[i][1]  #FP
        else:
            mat[1][0] += y_pred[i][0]  #FN
            mat[0][0] += y_pred[i][1]  #TP

    # mat[0][0] /= len(y_pred)
예제 #5
0
	def __init__(self, datafunc):
		self.tr = imm.ImageManager()
		self.datafunc = datafunc
예제 #6
0
 def setUp(self):
     self.image_manager = image_manager.ImageManager()
예제 #7
0
        res.append(temp)
        i = i + 1
    return res


def caculate_mi_list(dir_path):
    files = common.get_filelist(dir_path)
    res = _caculate_mi_list(files[3], files[0:10])
    data_a, data_b = Bar.cast(res)
    print data_a
    print data_b
    bar = Line("甜甜的实验", "二哥出品")
    bar.use_theme('vintage')
    bar.add("数据", data_a, data_b)
    bar.render()
    return


if __name__ == '__main__':
    # dir_path = "/home/snow/pengbaojiang/data/map_img/"
    if len(sys.argv) != 2:
        print "param error"

    dir_path = sys.argv[1]
    manager = ima.ImageManager("snow")
    manager.add_dir(dir_path)
    manager.load()
    file_path = manager.get_allimages_path()
    num = len(file_path)
    print num