# -*- coding: utf-8 -*- """ Created on Wed Jun 22 16:38:27 2016 @author: Milos """ import notebookOperacije as my # TODO - IMAGE PROCESSING # ucitavanje digitalne slike img_color = my.load_image('images/stop15.jpg') my.plt.figure(1) my.display_image('Ucitavanje digitalne slike', img_color) # formiranje grayscale slike img_grayscale = my.image_gray((img_color)) my.plt.figure(2) my.display_image('Formiranje grayscale slike', img_grayscale) # formiranje binarne slike img_bin = my.image_bin_adaptive(img_grayscale) my.plt.figure(3) my.display_image('Formiranje binarne slike', img_bin) # uklanjanje šuma sa binarne slike img_no_noise = my.remove_noiseColor(img_bin) my.plt.figure(4) my.display_image('img_bin sa remove_noise', img_no_noise) # pronalaženje regiona od interesa
# -*- coding: utf-8 -*- """ Created on Fri Jun 24 15:30:21 2016 @author: Milos """ import notebookOperacije as my import neuralNetwork as nn import numpy as np # TODO - NEURAL NETWORK TRAIN # obučavanje neuronske mreže image_original_obucavanje = my.load_image('images/obucavajuciSkup12.jpg') image_obucavanje = my.remove_noise(my.image_bin(my.image_gray(image_original_obucavanje))) img_selected_regions_obucavanje, regions_obucavanje, regions_color_obucavanje, regions_signs_obucavnje = my.select_roiV3(image_original_obucavanje.copy(), image_obucavanje, 'TRAIN') my.plt.figure(3) my.display_image('img_selected_regions_obucavanje', img_selected_regions_obucavanje) inputs_obucavanje = nn.prepare_for_ann(regions_obucavanje) ''' #signs_alphabet = ['Obavezno zaustavljanje', 'Zabrana saobraćaja u oba smera'] signs_alphabet = {} for x in range(0, 8): signs_alphabet[x] = str((x+1)*10) #print "We're on time %d" % (signs_alphabet[x]) ''' signs_alphabet = ['opasnost na putu', 'ogranicenje 30', 'obrnuti trougao', 'stop', 'zabrenjo oba smera', 'ogranicenje 40', 'zabranjeno polukruzno', 'obavezan smer desno', 'pesacki prelaz'] outputs_obucavanje = nn.convert_output(signs_alphabet) print '\nlen(inputs_obucavanje)=', len(inputs_obucavanje), ' len(outputs_obucavanje)=', len(outputs_obucavanje)
# -*- coding: utf-8 -*- """ Created on Sun Jun 26 18:01:03 2016 @author: Milos """ import notebookOperacije as my import cv2 import numpy as np # TODO - IMAGE PROCESSING img_path = 'images/obucavajuciSkup13.jpg' # ucitavanje digitalne slike img_color = my.load_image(img_path) my.plt.figure(1) my.display_image('TRAIN_Ucitavanje digitalne slike', img_color) # ucitavanje hsv slikes img_hsv = my.load_imageHSV(img_path) my.plt.figure(5) my.display_image('TRAIN_img_hsv', img_hsv) # define range of blue color in HSV lower_blue = np.array([100,50,50]) upper_blue = np.array([130,255,255]) mask_blue1 = cv2.inRange(img_hsv, lower_blue, upper_blue) # define range of red color in HSV lower_red = np.array([0,50,50])
# -*- coding: utf-8 -*- """ Created on Wed Jun 22 16:38:27 2016 @author: Milos """ import notebookOperacije as my # TODO - IMAGE PROCESSING # ucitavanje digitalne slike img_color = my.load_image('images/obucavajuciSkup7.jpg') my.plt.figure(1) my.display_image('Ucitavanje digitalne slike', img_color) # formiranje grayscale slike img_grayscale = my.image_gray((img_color)) my.plt.figure(2) my.display_image('Formiranje grayscale slike', img_grayscale) # formiranje binarne slike img_bin = my.image_bin_adaptive(img_grayscale) my.plt.figure(3) my.display_image('Formiranje binarne slike', img_bin) # uklanjanje šuma sa binarne slike img_no_noise = my.remove_noise(img_bin) my.plt.figure(4) my.display_image('img_bin sa remove_noise', img_no_noise) # pronalaženje regiona od interesa