CLICK HERE FOR FREE BLOGGER TEMPLATES, LINK BUTTONS AND MORE! »

Monday, April 30, 2012

Week 11 ( 2. April. 2012 )

Assalamualaikum

Title of Activity :
- Study for experimental result.

Objective :
- To tested the proposed systems whether the systems is going fine or not.

Content / Procedure
- Test and simulate all the car plates taken and the percentage of successful experiments in the systems.
- Study of factors that makes the systems does not function properly.
- A set of 50 images were taken from :

a) Complex scene, in which several objects with complex textures are presented.
b) Various environment ( street, roadside and parking lot ).
c) Different inclined angles and distances relative to camera.

 - Different angles -


- Distance from the camera - 

- Car plate size - 

- A shiny surface -

- The fracture surface -

Result / Analysis :
- Performance for individual system subsection were as follows : 92.1 % of plates were located successfully, 85% characters were segmented correctly, 50 % of characters manually extracted plates and 93.2 % of these characters were correctly classified.
- The major factors of errors was mainly due to bad quality of input image during the acquisition stage.

Week 9 - 10 ( 22. March. 2012 )

Assalamualaikum...

Title of Activity :
- Recognizing license plate characters.

Objective :
- To identified and to finalize the results are ASCII character and numbers of the plate.
- To get a similar result like a segmentation process.
- To ensure which the architecture of a neural network want to be used.

Content / Procedure :
- Used a Multi Layer Perceptron Network trained with the back propagation algorithm.
- During learning process, characters of the constituted database are successively presented at the input layer of Multi Layer Perceptron Network and their corresponding outputs are compared to the desire output.
- Implementing Multi Layer Perceptron Network with two hidden layers of 35 and 10 neurons as neural network.
- I use 30 data on the pictures. 20 of them were used for training and last 12 were used for simulating and testing.
- The training data will get from Image Processing for the neural network is based on input training.bmp image which has exactly 36 characters ( 25 alphabets 10 numbers ). Every type of character is train automatically once we simulate the program.

Result / Analysis :

 ~ Neural Network Training Tool ~

- There are some problems when using fan beam transforms method, the systems cannot recognize the plate numbers.

- Fan beam transform method -

- Change from Fan beam transform method to other character recognition method. The result will get same, but must to train the alphabet and number more frequently.
- The most challenging part is about need to change the source code to suitable method many times. 


Tuesday, March 27, 2012

Week 8 ( 12.March.2012 )

Assalamualaikum.

Title of Activity :
- Character Segmentation.


Objective :
- To get a more accurate binarization results, this process uses several local threshold values since the illumination of the plates.


Content / Procedure
- Adding some code to ease the process of identifying the characters.
- Divide the extracted plate into different images, each containing one isolated character.

TotalArea = 0;
            idx = [];
            for cnt = 1:size(stats,1)
                HWratio = (stats(cnt).BoundingBox(4)/stats(cnt).BoundingBox(3));
                density = stats(cnt).Area / (stats(cnt).BoundingBox(3)*stats(cnt).BoundingBox(4));
                area = stats(cnt).Area;
                
                x1 = ceil(stats(cnt).BoundingBox(1));
                y1 = ceil(stats(cnt).BoundingBox(2));
                x2 = ceil(stats(cnt).BoundingBox(1) + stats(cnt).BoundingBox(3));
                y2 = ceil(stats(cnt).BoundingBox(2) + stats(cnt).BoundingBox(4));
                
                if x1 > size(BW3,2)
                    x1 = size(BW3,2);
                end


                if x2 > size(BW3,2)
                    x2 = size(BW3,2);
                end
                
                if y1 > size(BW3,1)
                    y1 = size(BW3,1);
                end


                if y2 > size(BW3,1)
                    y2 = size(BW3,1);
                end
                
                GradientMagnitude = size(find(edge(BW3(y1:y2, x1:x2),'log') == 1),1);
                
                if(density > LLimit_Density) && (density < HLimit_Density) ...
                        && (area > LLimit_Area) && (area < HLimit_Area) ...
                        && (HWratio > LLimit_HWratio) && (HWratio < HLimit_HWratio) ...
                        && (GradientMagnitude > LLimit_GradientMagnitude) && (GradientMagnitude < HLimit_GradientMagnitude)
                    
                    idx = [idx cnt];
                    TotalArea = TotalArea + area;
                end
                
                
            end
             
            BW4 = ismember(labelmatrix(cc), idx);            
            cc = bwconncomp(BW4);
            
            if (TotalArea > LLimit_TotalArea) && (TotalArea < HLimit_TotalArea) ...
                    && (cc.NumObjects >= LLimit_NumOfCharacter) && (cc.NumObjects <= HLimit_NumOfCharacter)
                
                % Find the distance between each character
                stats = regionprops(BW4, 'Centroid', 'BoundingBox');
                CenterOfCharacter = [];
                for cnt = 1:size(stats,1)
                    CenterOfCharacter(cnt,:) = stats(cnt).Centroid;                    
                end
                [B, ind] = sort(CenterOfCharacter(:,1), 1);
                SortedCharacter = CenterOfCharacter(ind,:);
                dist = [];
                for cnt = 1:size(SortedCharacter,1)-1
                    dist(cnt,:) = norm(SortedCharacter(cnt,:)-SortedCharacter(cnt+1,:));                    
                end
                                
                for cnt = 1:size(dist,1)-5
                    space_between_character = dist(cnt+2);
                    dist_segment = [dist(cnt:cnt+1); dist(cnt+3:cnt+5)];
                    avg_dist = mean(dist_segment); std_dist = std(dist_segment);


                    if((space_between_character / avg_dist) > RatioBetweenSpaceDistAndAvrDist) ...
                            && (std_dist < MaxStdOfCharDist)
                        
                        BW5 = ismember(labelmatrix(cc), [cnt:cnt+6]);
                        cc = bwconncomp(BW5);
                                                                      
                        for seg_cnt = cnt:cnt+6
                            BW6 = imcrop(BW5, stats(seg_cnt).BoundingBox);
                            ImgSegment{AllowedSegmentCnt} = imresize(BW6, [20 10]);
                            AllowedSegmentCnt = AllowedSegmentCnt + 1; 
                                                   
                        end % for seg_cnt = cnt:cnt+6
                        
                    end % if((space_between_character / avg_dist) > 1.5) && (std_dist < 3)
                       
                end % for cnt = 1:size(dist,1)-5
                                
            end


        end % for j=1:size(VProSegment{i}.Profile,1)
    end 
end


% Show image of each character
if (isempty(ImgSegment) == 0)


    for cnt = 1:size(ImgSegment,2)    
        figure; imshow(ImgSegment{cnt});
    end
    
end


Result / Analysis
- Stretch the contrast of the image to extend over the entire range of grey levels available.
- Resize each character to the standard height and width in order to be used in the following recognition process.




Week 7 ( 5. March. 2012 )

Assalamualaikum

Title of Activity :
- Extracting the image of license plate

Objective :
- To locate the vehicle license`s plate.

Content / Procedure :
- Adding some source code to eliminating the noise.

Result / Analysis :
- The process contains each phase performs a segmentation process on the grey image to eliminate the redundant pixels that don`t belong to a plate region.

clear all; close all; clc;

% Threshold
LLimit_Density = 0.20;
HLimit_Density = 1.50;

LLimit_Area = 30;
HLimit_Area = 2000;

LLimit_HWratio = 0.3;
HLimit_HWratio = 9.5;

LLimit_TotalArea = 400;
HLimit_TotalArea = 3000;


% Display result
DisplayGrayImage = 1;
DisplayMedianFiltering = 1;
DisplayHorizontalProfile = 1;
DisplayVerticalProfile = 1;

% Get a list of all the images name in folder images
InputImg = imread('images\499.JPG');
InputImg = im2double( InputImg );

% Convert To Grayscale Using the NTSC standard
red = immultiply( InputImg(:,:,1), 299 );
green = immultiply(  InputImg(:,:,2), 587 );
blue = immultiply( InputImg(:,:,3), 114 );

ProcessImg = red + green + blue;
ProcessImg = imdivide( ProcessImg, 1000 );
if DisplayGrayImage == 1
    figure; hold on; imshow( ProcessImg );
end

% Perform median filtering to remove noise
ProcessImg = medfilt2(ProcessImg, [5 5]);
if DisplayMedianFiltering == 1
    figure; hold on; imshow( ProcessImg );
end

I = ProcessImg;
if ~(isa(I,'double') || isa(I,'single')); I = im2single(I); end
gh = imfilter(I,fspecial('sobel') ,'replicate');
gv = imfilter(I,fspecial('sobel')','replicate');
EdgeImg = abs(gh) + abs(gv);  
%figure, imshow(EdgeImg);

% Create horizontal profile
HProfile = sum(EdgeImg,2);
H_thres = mean(HProfile);  

[ Filtered_HProSegment ] = ProfileSegmentation( HProfile, H_thres*0.75, 15);

if DisplayHorizontalProfile == 1

    clear rgb_img;
    rgb_img(:,:,1) = uint8(EdgeImg * 255);
    rgb_img(:,:,2) = uint8(EdgeImg * 255);
    rgb_img(:,:,3) = uint8(EdgeImg * 255);

    for i=1:size(Filtered_HProSegment,1)
        for j=1:size(rgb_img,2)
            rgb_img(Filtered_HProSegment(i,1),j,1) = 255;
            rgb_img(Filtered_HProSegment(i,1),j,2) = 0;
            rgb_img(Filtered_HProSegment(i,1),j,3) = 0;

            rgb_img(Filtered_HProSegment(i,2),j,1) = 255;
            rgb_img(Filtered_HProSegment(i,2),j,2) = 0;
            rgb_img(Filtered_HProSegment(i,2),j,3) = 0;          
        end
    end

    figure; imshow(rgb_img);

end

% Find the Horizontal Density Vector
HDV = zeros(size(Filtered_HProSegment,1), size(EdgeImg,2));
M = 150;

for k=1:size(Filtered_HProSegment,1)
    SlidingWindowsArea = (Filtered_HProSegment(k,2) - Filtered_HProSegment(k,1)) * M;
    for width_cnt = 1:size(EdgeImg,2)          

        min_w = width_cnt - M;
        max_w = width_cnt + M;

        if min_w < 1
            min_w = 1;
        end

        if max_w > size(EdgeImg,2)
           max_w = size(EdgeImg,2);
        end

        %SlidingWindowsArea = (max_w - min_w )* M;
        SumG = sum(sum(EdgeImg(Filtered_HProSegment(k,1):Filtered_HProSegment(k,2), min_w:max_w)));
        HDV(k,width_cnt) = SumG/SlidingWindowsArea;

    end

    V_thres = mean(HDV(k,:));  
    FoundProfile = ProfileSegmentation( HDV(k,:)', V_thres, 100);
    VProSegment{k}.Profile = [];
    if size(FoundProfile,1) > 0
        VProSegment{k}.Profile = FoundProfile;
    end
end

if DisplayVerticalProfile == 1
    clear rgb_img;
    rgb_img(:,:,1) = uint8(EdgeImg * 255);
    rgb_img(:,:,2) = uint8(EdgeImg * 255);
    rgb_img(:,:,3) = uint8(EdgeImg * 255);

    figure; imshow(rgb_img); hold on;  
    for i=1:size(Filtered_HProSegment,1)
        if isempty(VProSegment{i}.Profile) == 0
            for j=1:size(VProSegment{i}.Profile,1)
                x = VProSegment{i}.Profile(j,1);
                y = Filtered_HProSegment(i,1);          
                w = VProSegment{i}.Profile(j,2) - VProSegment{i}.Profile(j,1);
                h = Filtered_HProSegment(i,2) - Filtered_HProSegment(i,1);          
                rectangle('Position',[x,y,w,h], 'EdgeColor', 'Red', 'LineWidth',2)          
            end
        end
    end
end

% Auto-skew correction
level = graythresh(InputImg);
BW_ProcessImg = im2bw(InputImg,level);

for i=1:size(Filtered_HProSegment,1)
    if isempty(VProSegment{i}.Profile) == 0
        for j=1:size(VProSegment{i}.Profile,1)

            x1 = VProSegment{i}.Profile(j,1);
            y1 = Filtered_HProSegment(i,1);
            x2 = VProSegment{i}.Profile(j,2);
            y2 = Filtered_HProSegment(i,2);

            ProcessImgSegment = BW_ProcessImg(y1:y2, x1:x2);
            EdgeSegment = EdgeImg(y1:y2, x1:x2);                                

            level = graythresh(EdgeSegment);
            BW = im2bw(EdgeSegment,level*0.2);

            BW1 = imfill(BW,'holes');

            cc = bwconncomp(BW1);
            stats = regionprops(BW1, 'Area', 'FilledImage');
            SumBW = 0;
            for cnt =1:size(stats,1)
                SumBW = SumBW + stats(cnt).Area;
            end
            MeanBW = SumBW/size(stats,1);
            idx = find([stats.Area] > MeanBW*0.2);
            BW2 = ismember(labelmatrix(cc), idx);
            se = strel('disk',5);
            BW2 = imclose(BW2,se);
            %figure; imshow(BW2);


            % Find the skew angle by using hough transform
            %BW22 = edge(BW2,'canny');
            [H,T,R] = hough(BW2);
            P  = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:))));
            lines = houghlines(BW2,T,R,P,'FillGap',5,'MinLength',7);

            DetectedSkew = 0;
            if isempty(fieldnames(lines)) == 0
                max_len = 0;
                max_ind = 0;
                for cnt =1:size(lines,2)                  
                    len = norm(lines(cnt).point1 - lines(cnt).point2);
                    if ( len > max_len)
                      max_len = len;
                      max_ind = cnt;
                   end
                end
                DetectedSkew = lines(max_ind).theta;
            end

            % Deskew the car plate image
            if DetectedSkew == 0
               tf = [1 0 0; 0 1 0; 0 0 1];                  
            else
               tf = [1 tand(90 - DetectedSkew) 0; 0 1 0; 0 0 1];                  
            end
            tform = maketform('affine', tf);
            BW3 = imtransform(BW2 & ProcessImgSegment, tform);            
            se = strel('disk',1);      
            BW3 = imerode(BW3,se);
            %figure; imshow(BW3);
         
            cc = bwconncomp(BW3);
            stats = regionprops(BW3, 'ConvexHull', 'Area', 'BoundingBox');

         
            % Check the properties
            fig_BW_disp = figure;
            for cnt = 1:size(stats,1)
                BW_disp = BW3;
                clf(fig_BW_disp);
                figure(fig_BW_disp); imshow(BW_disp); hold on;
                rectangle('Position',stats(cnt).BoundingBox,'EdgeColor','red','LineWidth',2);

                HWratio = (stats(cnt).BoundingBox(4)/stats(cnt).BoundingBox(3))
                density = stats(cnt).Area / (stats(cnt).BoundingBox(3)*stats(cnt).BoundingBox(4))
                area = stats(cnt).Area
                pause
            end
       
            % Condition: Check the density
            TotalArea = 0;
            idx = [];
            for cnt = 1:size(stats,1)
                HWratio = (stats(cnt).BoundingBox(4)/stats(cnt).BoundingBox(3));
                density = stats(cnt).Area / (stats(cnt).BoundingBox(3)*stats(cnt).BoundingBox(4));
                area = stats(cnt).Area;
                if(density > LLimit_Density) && (density < HLimit_Density) ...
                        && (area > LLimit_Area) && (area < HLimit_Area) ...
                        && (HWratio > LLimit_HWratio) && (HWratio < HLimit_HWratio)
                    idx = [idx cnt];
                    TotalArea = TotalArea + area;
                end
            end        
         
            BW4 = ismember(labelmatrix(cc), idx);          
            cc = bwconncomp(BW4);
         
            if (TotalArea > LLimit_TotalArea) && (TotalArea < HLimit_TotalArea) ...
                    %&& (cc.NumObjects >= LLimit_NumOfCharacter) && (cc.NumObjects <= HLimit_NumOfCharacter)
                figure; imshow(BW4);
            end


        end
    end
end

- Get the illustrates an edge detection process.


Conclusion.
- Through this process, I can detect few factors contribute to this process failed which is :

a) Shining of surface plate.
b) A dirty plate surface.
c) Damaged of surface plate.




- Need more magic image to get successful result.

Wednesday, March 21, 2012

Week 6 ( 27.February.2012 )

Assalamualaikum

Title of Activity :
- Pre - Processing Image

Objective :
- To prepare the images for further processing by the systems.

Content / Procedure :
- Need to put some source coding in MATLAB to make the extracting image run.

Result & Analysis :
- The system will convert RGB images to gray - level images using the NTSC method :

Gray = 0.299*Red + 0.587*Green + 0.114*Blue

click to enlarge

- A median filter is applied to gray level image in order to remove noise, while preserving the sharpness of image. 

Original Image

 After Pre-Processing Image

Conclusion :
- 100% all the image taken, are successfully to convert from RGB image to grayscale image.

Week 5 ( 14.February.2012 )

Assalamualaikum

Title of Activity :
- Final Year Project Briefing.
- Find the source code for extracting image.

Objective :
- To guide student to build the blog for replacement of log book.
- To learn and search the source code for extracting image.

Content / Procedure :
- Find the website and book where is reveal about the source code.

Result & Analysis :
- FYP blog has been completed.


- The first thing you need to do is to get comfortable using Matlab. You need to give yourself a couple of hours to play with Matlab, sit down at an Athena terminal (or purchase and install Matlab on your PC), open Matlab up, and start running some demos. If you type,


>> helpdesk
a Web page will open with links to all sorts of demos and reference information.It is an excellent idea to type in the commands in NMM sections 2.1 and 2.2, to see what they do, and to get familiar with using the Matlab command line. (But don’t worry about the comparison with FORTRAN towards the end of 2.2). Experiment! Nothing you type will break the computer; if you get confused you can type.

>> clear
which will erase all the variables you have defined, and give you a clean slate.Pay attention to the use and special meaning of these symbols in Matlab, misuse can lead to confusing bugs:
; : ( ) [ ] ‘ “ %
Also, beware of the critical difference between * and .*, between / and ./, and between ^ and .^
Unless you intend to do a matrix operation or dot product, you will want to use the versions with the dots.

For scientific notation, type
>> y=4e8
not
>> y=4x10^8Beware that Matlab is case-sensitive, i.e. capital letters and lower-case letters are usually treated as complete different, and essentially all of the functions provided by Matlab are written in lower-case only. If you type

>> help plot
Matlab will give you all sorts of documentation about how the Matlab plot function works. In the Matlab documentation, it refers to some functions using ALL CAPITAL LETTERS, but when you use those functions you must actually type them in lower case, not in capitals.

Conclusion :
- I can conclude that I more comfortable with this software.

Week 3 till Week 4 ( 30. January. 2012 - 13. February.2012 )

Assalamualaikum

Title of Activity :
- Study Matlab R2010a

Objective :
- To learn the methods of Matlab.
- To ensure the project progress running smoothly.

Content / Procedure :
- Read about Numerical Methods with Matlab which is gives a lot of detailed information that require in my project.



Result & Analysis.
- Getting started to get comfortable with Matlab by watching the video where is teaching the processes of the software.



- In general, when you start the MATLAB program, it displays the MATLAB desktop. The desktop is a set of tools (graphical user interfaces or GUIs) for managing files, variables, and applications associated with MATLAB. The first time you start MATLAB, the desktop appears with the default layout, as shown in the following illustration. 




- The MATLAB desktop manages the tools listed in the table that follows. Not all of the tools appear by default when you first start MATLAB. If you prefer a command-line interface, you can often use functions to accomplish the same results. The documentation for each tool provides instructions for using functions to perform the task. These instructions are typically labeled as Function Alternatives.


Conclusion :
- As the conclusion, I can conclude that MATLAB is a quite easy to use by understanding the process of the software.