Exemple #1
0
 def download_reference_image(self):
     """Downloads the last taken image and save it as the reference image"""
     f = image_file.format(convert_number(0), self.camera_model.image_ext)
     fpath = join(images_dir, f)
     folder, f = self.get_last_folder_file()
     url_photo = self.camera_model.url_photo.format(self.url, folder, f)
     self.append_image_to_queue(fpath, f, url_photo, threading=False)
     resize_image(fpath)
Exemple #2
0
 def _download_previews_in_background(self):
     # download previews
     while len(self.queue_preview) > 0:
         try:
             with self.lock:
                 url, fname = self.queue_preview.pop(0)
             fpath = join(resized_images_dir, fname)
             urlretrieve(url + "?size=view", fpath)
             resize_image(fpath, self.img_num > 0)
             if self.img_num > 0:
                 for listener in self.listeners:
                     listener.update_downloaded_preview(fname)
         except Exception, e:
             self.logger.error(str(e))
Exemple #3
0
 def _add_btn_fired(self):
     points = self.roi_selector.define_roi()
     if len(points) > 1:
         self.points.append(deepcopy(points))
         fpath = join(corr_properties_dir, roi_file)
         img_name = join(images_dir, basename(self.fname))
         roi = self.roi_selector.create_roi(imread(img_name), self.points)
         imwrite(fpath, roi)
         imwrite(join(resized_images_dir, roi_file),
                 resize(roi, (300, 225)))
         files = get_all_files(images_dir)
         for f in files:
             resize_image(join(images_dir, f), True)
         self.ref_image = ImageResource(self.fname)
Exemple #4
0
 def load_project_from_server(self, project):
     self.logger.debug("Download project from server")
     self.server.download_project(project)
     files = get_all_files(images_dir)
     n = len(files)
     progress = ProcessDialog(title="Resize images", max_n=n)
     for i in range(n):
         f = files[i]
         self.logger.debug("Resize image: {0}".format(f))
         progress.update(i, "Resize image: {0}".format(f))
         try:
             resize_image(join(images_dir, f), True, True)
         except Exception:
             resize_image(join(images_dir, f))
     progress.close()
     self.create_strain_files()
Exemple #5
0
 def _reset_btn_fired(self):
     del self.points[:]
     files = get_all_files(images_dir)
     for f in files:
         resize_image(f)
     self.ref_image = ImageResource(self.fname)