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 img_selected_regions, regions, regions_by_color, regions_signs = my.select_roiV3(img_color.copy(), img_no_noise, 'appRun') print '\nBroj prepoznatih regiona (regions):', len(regions) print 'Broj prepoznatih regiona (regions_by_color):', len(regions_by_color) print 'Broj prepoznatih regiona (regions_signs):', len(regions_signs) my.plt.figure(5) my.display_image('img_selected_regions', img_selected_regions) ''' # koliko regiona je odgovarajuće boje regions_signs = [] my.findRegionsWithColor(img_color.copy(), regions_color, regions_signs) print '\nfindRegionsWithColor -> len(regions_signs)=', len(regions_signs) ''' ''' # roiv4
# -*- 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)