MATLAB Answers

Detecting Traffic lights using machine learning

9 views (last 30 days)
Shahrin Islam
Shahrin Islam on 19 Oct 2018
Commented: Shahrin Islam on 19 Oct 2018
Hello everyone. I am new matlab learner and working on a project to detect traffic lights using machine learning. In the first portion of my code i have this line "pkg load image". When i execute the code, matlab showing me error in this line and as a new learner i don't understand what is it. Please help me with this. here i am attaching the code below-

  1 Comment

Shahrin Islam
Shahrin Islam on 19 Oct 2018
%% This script will detect traffic ligth's color %% in an infinitive loop. %% %% Author: Tomasz Ceszke 2017
%% ----------- init clear ; close all; more off pkg load image;
source('conf/settings.m'); source('lib/features.m'); source('lib/log_reg.m');
%% ----------- load learned factors load 'theta.mat';
%% ----------- settings live_image_path = strcat(datasource_path_prefix,'live/scene.png');
%% fprintf('Path to detect: %s \n\n',live_image_path); while 1 pause(1); try live_image = imread(live_image_path); catch disp('No image'); continue; end
X = zeros(1,numel(live_image));
X = reshape(double(rgb2gray(live_image)),1,[]);
if normalization
X = normalize(X,0);
[r h] = recognize(theta,X);
if r==1
color = 'GREEN';
color = 'RED';
fprintf('%s h(x)=%.2f\n',color,h)

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by