% --- Executes on button press in loadButton.
function loadButton_Callback(hObject, eventdata, handles)
% hObject handle to loadButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%**************************************************************************
%% FIRST BLOCK (Read/digitize input image)
%**************************************************************************
skip = 0;
default_path = 'C:\Received Images';
[fname fpath] = uigetfile('*.jpg', 'Choose Car Image', default_path);
if fname ~= 0,
choosen_image = strcat(fpath, fname);
retrieved_image = imread(choosen_image);
axes(handles.axes1);
imshow(retrieved_image);
save('temp.mat','retrieved_image','fname'); % Can be replaced by handles
end
% --- Executes on button press in searchPlateButton.
function searchPlateButton_Callback(hObject, eventdata, handles)
% hObject handle to searchPlateButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
debug = guidata(handles.debugBox);
debug_flag = debug.flag;
if debug_flag == 1,
axes(handles.axes1);
set(handles.searchPlateButton,'Enable','off');
set(handles.contButton,'Enable','on');
set(handles.debugBox,'Enable','off');
end
error_flag = 0;
try
Load = load('temp.mat');
catch error
disp('Sorry..You have to load the image');
error_flag = 1;
end
if error_flag == 0,
retrieved_image = Load.retrieved_image;
fname = Load.fname;
%% PREPROCESSING BLOCK
[original_image connected_image] = createObject(retrieved_image, fname);
%% DETECTION/SEGMENTATION BLOCK
%% Pre-ANALYSIS
processed_image = thirtyPercent(connected_image); % remove 30%
detectObjects(processed_image); % Do nothing to the image. Only draw rect box for every objects
if debug_flag == 1, uiwait; else uiresume; end
%% ANALYSIS BASED ON RULEs
% Rule 1 - Crops the image by ignoring boxes with more than 1 object.
[crops] = cropsObject(original_image, processed_image);
if debug_flag == 1, uiwait; else uiresume; end
% Rule 2
[crops] = compactCheck(original_image, crops);
if debug_flag == 1, uiwait; else uiresume; end
% Rule 3
[crops] = angleCheck(original_image, crops);
if debug_flag == 1, uiwait; else uiresume; end
% Rule 4
[crops] = hvCheck(crops);
%Plot the plate
plotImage(retrieved_image, crops);
[ignored count] = size(crops);
for i=1:1:count, % 'count' is the number of images stored in 'crops'
BW = crops(i).obj; % Retrieve every image to be analyzed
%------------------------------------------------------------------
BWthin = bwmorph(BW,'thin',Inf);
subplot(count,1,i,'Parent',handles.myPanel)
imshow(BWthin), title('Image Processed')
%------------------------------------------------------------------
end
set(handles.debugBox,'Enable','on');
set(handles.contButton,'Enable','off');
set(handles.searchPlateButton,'Enable','on');
end
Hello world!
-
Welcome to WordPress. This is your first post. Edit or delete it, then
start writing!
10 months ago
1 comments:
Accidentally went to ur blog.
I cannot execute the code in MATLAB.
Post a Comment