python_wrapper.py
Go to the documentation of this file.
00001 #object recognition code
00002 #meera hahn
00003 from scipy.misc import imread, imresize, imsave
00004 import os, sys
00005 import subprocess
00006 # def rec_obj(image_path, image_folder):
00007 #       img = imread(image_path)
00008 #       y_size = img.shape[0]
00009 #       x_size = img.shape[1]
00010 #       window_size = 600
00011 #       i = 0
00012 #       while(i < (y_size - window_size)):
00013 #               j = 0
00014 #               while(j < (x_size - window_size)):
00015 #                       bin = img[i:(i+window_size), j:(j+window_size),:]
00016 #                       #save bin as new_path
00017 #                       imsave(image_folder + "bin.jpg", bin)
00018 #                       #cmnd = './darknet coco test cfg/yolo-coco.cfg yolo-coco.weights ' + new_path
00019 #                       #os.system(cmnd)
00020 #                       j  = j + 256
00021 #               i = i + 256
00022 
00023 
00024                         #parse output_file
00025                         #get predictions
00026                         #translate predictions to whole image_path
00027         #get rid of overlaping predictions
00028         #return the predictions
00029 
00030 def rec_obj(image_path, image_folder):
00031         img = imread(image_path)
00032         y_size = img.shape[0]/2
00033         x_size = img.shape[1]/2
00034         window_size = 600
00035 
00036         for i in range(0,2):
00037                         bin = img[:, i*x_size:(x_size + (i*x_size)),:]
00038                         imsave(image_folder + "bin.jpg", bin)
00039 
00040 
00041 if __name__ == '__main__':
00042         #path where pics will be
00043         path = '/home/meerahahn/Documents/classes/Mini-Projects/obj_rec/robot_things/'
00044         #sample image
00045         rec_obj('/home/meerahahn/Documents/classes/Mini-Projects/obj_rec/robot_things/frame0001.jpg', path)
00046 


rail_object_detector
Author(s):
autogenerated on Sat Jun 8 2019 20:26:30