def start(filename): print "filename is ", filename #filename = "53.jpg" try: img = cv2.imread(filename, 0) plt.imshow(img, 'gray') #original image plt.show() except: print "oops! unable to open image, try again" import pathgui return print "Before preprocess" image_object = ip.image_processing(img) print "After preprocess object" image_object.preprocess() print "After preprocessing" image_object.find_contour() plt.imshow(image_object.canvas, 'gray') plt.show() print "After contour" image_object.find_corners() print "After corners" image_object.straighten_image() print "After straight image" sudoku_grid = image_object.isolate_digits() image_object.print_grid() solver_object = ss.solve_sudoku(sudoku_grid) print "The given sudoku grid has ", solver_object.count, " solutions." if solver_object.count > 0: image_object.paint_image(solver_object.all[0]) plt.imshow(image_object.original_img, 'gray') #output plt.show() import pathgui #start("1.JPG")
import preprocessing as ppr import os #Parameters raw_data = 'rawdata' data_path = 'data' height = 100 width = 100 if not os.path.exists(data_path): ppr.image_processing(raw_data, data_path, height, width) all_classes = os.listdir(data_path) number_of_classes = len(all_classes) color_channels = 3 epochs = 300 batch_size = 10 batch_counter = 0 model_save_name = 'checkpoints/'
def main(): train_gen, test_gen = image_processing() classifier(train_gen, test_gen)
def build_seq_with_processing(self, frames, shape, BW): '''Frames is a list of paths to the frames of a given video''' return [ image_processing(img, self.image_shape, as_BW=BW) for img in frames ]