def color_recognition(crop_img): height, width, channels = crop_img.shape crop_img = crop_image.crop_center(crop_img, 50, 50) # crop the detected vehicle image and get a image piece from center of it both for debugging and sending that image piece to color recognition module # for debugging #cv2.imwrite(current_path + "/debug_utility"+".png",crop_img) # save image piece for debugging open(current_path+"/utils/color_recognition_module/"+"test.data", "w") color_histogram_feature_extraction.color_histogram_of_test_image(crop_img) # send image piece to regonize vehicle color prediction = knn_classifier.main(current_path + "/utils/color_recognition_module/" + "training.data", current_path + "/utils/color_recognition_module/" + "test.data") return prediction
def color_recognition(crop_img): (height, width, channels) = crop_img.shape crop_img = crop_image.crop_center( crop_img, 50, 50 ) #recorte la imagen del vehículo detectada y obtenga una pieza de la imagen desde el centro # de la misma tanto para depurar como para enviar esa pieza de imagen al módulo de reconocimiento de color # para debug # cv2.imwrite(current_path + "/debug_utility"+".png",crop_img) # save image piece for debugging open(current_path + '/utils/color_recognition_module/' + 'test.data', 'w') color_histogram_feature_extraction.color_histogram_of_test_image( crop_img) # Enviar pieza de imagen para el color del vehículo. prediction = knn_classifier.main( current_path + '/utils/color_recognition_module/' + 'training.data', current_path + '/utils/color_recognition_module/' + 'test.data') return prediction
def color_recognition(crop_img, input_video): (height, width, channels) = crop_img.shape crop_img = crop_image.crop_center(crop_img, 50, 50) # crop the detected vehicle image and get a image piece from center of it both for debugging and sending that image piece to color recognition module if input_video == 'input_video.mp4': # for debugging # cv2.imwrite(current_path + "/debug_utility"+".png",crop_img) # save image piece for debugging open(current_path + '/utils/color_recognition_module/' + 'test.data', 'w') color_histogram_feature_extraction.color_histogram_of_test_image(crop_img,input_video) # send image piece to regonize vehicle color prediction = knn_classifier.main(current_path + '/utils/color_recognition_module/' + 'training.data', current_path + '/utils/color_recognition_module/' + 'test.data') elif input_video == 'input_video1.mp4': open(current_path + '/utils/color_recognition_module/' + '1test.data', 'w') color_histogram_feature_extraction.color_histogram_of_test_image(crop_img,input_video) # send image piece to regonize vehicle color prediction = knn_classifier.main(current_path + '/utils/color_recognition_module/' + '1training.data', current_path + '/utils/color_recognition_module/' + '1test.data') return prediction