def saveImage(url, id): path = "%s/%s.jpg" % (IMAGE_DIR, id) pow2path = "%s/%s_p2.jpg" % (IMAGE_DIR, id) print "Saving to", path try: uos = urllib2.urlopen(url) except: print "Couldn't open", url return None try: file(path, "wb").write(uos.read()) except: print "Couldn't save", path return None ImageResizer.resizePow2(path, pow2path) return path
def Rs_Images(): bwidth = int(float(Width_Entry.get())) FilenameList = [] files = FilePaths for i in files: FilenameList.append(i) core.ResizeImages(FilenameList, bwidth)
def start(self): queue_memes = self._get_n_memes("queue") img_memes = self._get_n_memes("img") #self._delete_memes("queue", queue_memes) # DEBUG!!!!!!!!!!!!!!!!!!!!!!11 #self._delete_memes("img", img_memes) # !!!!!!!!!!!!!!!!!!!!!!!!!!!11 #Database.apply_query(config.DB_PATH, "DELETE FROM " + config.COOKIEJAR_TABLE_NAME) #kackcha.create_new(setup=True) # kill me plz # ugly, but works (just like a good ol soviet russian factory worker heh) i = 0 while 1: ImageResizer.delete_invalid_pics() kackcha.clean() # every ~24 mins if i > 60 * 24: i = 0 self._flush_identities() ImageResizer.resize_all( ) # make them fit in (the ImageResizer acts just like a f*****g normie) self.calculate_memerank() self.update_frontpage() time.sleep(1) i += 1
def _create_choose_dest(self): self.__dest_dir = tkFileDialog.askdirectory() self.log("Destination selected (" + self.__dest_dir + ")") self.__dest_dir_label.config(text="Destination: " + self.__dest_dir) self.__start_btn.config(state="normal") ImageResizer.do_scan_check(self)
def _create_choose_source(self): self.__src_dir = tkFileDialog.askdirectory() self.log("Source selected ("+self.__src_dir+")") self.__src_dir_label.config(text="Source: " + self.__src_dir) self.__start_btn.config(state="normal") ImageResizer.do_scan_check(self)
uniqueID = randint(0, 100000) parent_file_path = "/Users/sameer/Desktop/Python/FaceRecognition/" + word + "/" directory = os.path.dirname(parent_file_path) if not os.path.exists(directory): os.makedirs(directory) id_file_path = "/Users/sameer/Desktop/Python/FaceRecognition/" + word + "/" + str( uniqueID) + "/" print(id_file_path) directory_unique = os.path.dirname(id_file_path) if not os.path.exists(directory_unique): print("hello") os.makedirs(directory_unique) vidcap = cv2.VideoCapture( 'TabethaBoyajianThemostmysteriousstarintheuniverse.mp4') success, image = vidcap.read() count = 0 externalCount = 0 success = True while success: if externalCount % 3: success, image = vidcap.read() print('Read a new frame: ', success) if success: #cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG file ImageResizer.run(image, count) count += 1 externalCount += 1