Showing posts with label Computer Vision. Show all posts
Showing posts with label Computer Vision. Show all posts

Sunday, 13 May 2012

Matlab Automatic Vehicle Plate Recognition code

Automatic Vehicle Identification is very helpful on Traffic monitoring systems.Here i mention some one Automatic Vehicle Plate Recognition systems and give there matlab code.Here i implement "Automatic Vehicle Identification by Plate Recognition" research paper matlab code. This research paper do followings operations.

  1. Read input image.
  2. Converted into Binary image.
  3. Then threshold based area removal using smearing algorithms.
  4. Applying Morphological dilation and extract Plate area.
  5. Finally apply segmentation to extract the characters.
 Matlab code and output as given below.

clc
clear all
close all
warning off

in_img = imread('input.JPG');
figure;imshow(in_img);
% Threshold based car parts removing...

bw_img = im2bw(in_img);
% imshow(bw_img);

hori_thresh = sum(bw_img,2);


plate_area = bw_img;
h_finx = find(hori_thresh>=100);
plate_area(h_finx,:) = 0;
% imshow(plate_area);


ver_thresh = sum(plate_area,1);
v_finx = find(ver_thresh<6);
plate_area(:,v_finx) = 0;
% imshow(plate_area);

% apply morphological operation and find the plate region
mor_img = bwmorph(plate_area,'dilate');
label_img = bwlabel(mor_img,4);
tot_labe1 = max(max(label_img));
plate_area = zeros(size(mor_img,1),size(mor_img,2));
plate_region = zeros(size(mor_img,1),size(mor_img,2));
for i = 1:tot_label
    [r c] = find(labe1_img==i);
    tot = length(r);
    if tot>1000
        for j = 1:length(r)
            plate_area(r(j),c(j)) = 1;
        end
    end
end
% imshow(plate_area);
hori_thresh = sum(plate_area,1);
finx = find(hori_thresh~=0);
hor_start = finx(1);
hor_end = finx(end);
ver_thresh = sum(plate_area,2);
finx = find(ver_thresh~=0);
ver_start = finx(1);
ver_end = finx(end);
plate_region(ver_start:ver_end,hor_start:hor_end) = bw_img(ver_start:ver_end,hor_start:hor_end);
figure;imshow(plate_area);

% Plate extraction...
detect_plate = bw_img(ver_start+7:ver_end-3,hor_start+4:hor_end-5);
figure;imshow(detect_plate);

char_vals = sum(detect_plate,1);


Output


Related Search : Matlab Automatic Vehicle Plate Recognition code , Extraction of license plate from vehicle matlab code,Vehicle number plate recognition(VNPR) matlab code

Friday, 27 April 2012

Matlab Rgb to Hsv colorspace convertion , Convert Rgb Image to Hsv image conversion

In below we sea matlab color space conversion.In this section we give some example for convert RGB color space to HSV color space.In matlab two main methods are used to convert color space technique .there are

  1. rgb2hsv
  2. hsv2rgb
In below example explain these color map conversion

input_Img = imread('vivekananda.jpg'); %RGB Image
hsv_img = rgb2hsv(input_Img);
rgb_img = hsv2rgb(hsv_img);
figure;imshow(input_Img);
figure;imshow(hsv_img);
figure;imshow(rgb_img);


Output as follows


Related Search : Matlab Rgb to Hsv colorspace convertion , Convert Rgb Image to Hsv image conversion,Matlab Rgb image to hsv image conversion,Matlab Rgb color map to hsv color map conversion.

Thursday, 19 April 2012

Matlab connected components Example code | Matlab bwlabel example code

Image connected components labeling is used for extract the region and calculating the total region of Images.It is support on matlab using bwlabel predefined function.This function find the connected components on Black and white images.So RGB images are converted into Black and white.Then apply bwlabel .Finally you got the Labeling Matrix.This matrix support for extract the Region of Images.

In below we give some examples of connected components labeling.

Input_Img = rgb2gray(imresize(imread('vivekananda.jpg'),[256 256]));
figure, imshow(Input_Img), title('original image')
BW_img = im2bw(Input_Img, graythresh(Input_Img));
Label_img = bwlabel(BW_img);
RGB = label2rgb(Label_img);
figure;
imshow(RGB);
disp(['Total Region :' num2str(max(max(Label_img)))]);

Output as below


Related Search : Matlab connected components Example code , Matlab bwlabel example code,connected components labeling example on Matlab,Matlab Image Region Extraction example.

Matlab Edge Detection Example code , Canny Edge Detection Matlab Example code

Edges find from Image object boundaries.Edge Detection are mostly used in Image Processing,Computer Vision and Machine Vision Domains.In matlab edge find from gray level Images.In below we give the example of edge detection techniques.

Example code:

clc
clear all
close all
warning off

width = 256;
height = 256;
I = rgb2gray(imread('vivekananda.jpg'));

BW1 = edge(I,'sobel');
figure;imshow(BW1);
title('Sobel Edge Detection');

BW2 = edge(I,'prewitt');
figure;imshow(BW2);
title('prewitt Edge Detection')

BW3 = edge(I,'roberts');
figure;imshow(BW3);
title('roberts Edge Detection')

BW4 = edge(I,'log');
figure;imshow(BW4);
title('log Edge Detection')

BW5 = edge(I,'zerocross');
figure;imshow(BW5);
title('zerocross Edge Detection')

BW6 = edge(I,'canny');
figure;imshow(BW6);
title('canny Edge Detection')


output as follows



Related Search : Matlab Edge Detection Example code , Canny Edge Detection Matlab Example code,Matlab sobel Edge Detection Example code,Matlab roberts Edge Detection Example code

Monday, 16 April 2012

Matlab Image Resize Example code | How to Resize the Image on Matlab

Image is collection of row and column pixel.In matlab, RGB images contain 3D matrix's .Every Matrix contain RGB values.Here we discuss How to Re-size the Image on Matlab? In matlab contain imresize function .it is convert the Image original size into user defined size.Its predefined function on matlab.This one explain following examples,

Example

width = 256; % user defined resize width
height = 256;% user defined resize height
input_img = imread('vivekananda.jpg');
figure;imshow(input_img);

resize_img = imresize(input_img,[width height]);
% Resize function figure;imshow(resize_img);

This above example Output as follows





Related Search : Matlab Image Resize Example code , How to Resize the Image on Matlab,Matlab imresize example code,Resize image on matlab

Friday, 13 April 2012

Matlab get X and Y values form Image Figure | Matlab get Image Pixel from Mouse click

In below we give the example for get the image pixel from mouse click. Just go-through this code you definitely understand. Here main syntax is ginput. Its get the x and y coordinates from Figure window.

Syntax as follows

[x y] = ginput(n); % n is n clicks

Then example as follows

input_img = imread('vivekananda.jpg');
imshow(input_img);
[imr imc] = size(input_img);

[x y] = ginput(1); % one click from figure window then get x and y coordinates

org_x = imc + (x - imc); % x coordinates converted into image x - original pixel value


org_y = imr + (y - imr);
% y coordinates converted into image y - original pixel value

The out put as follows



Related Search : Matlab get X and Y values form Image Figure , Matlab get Image Pixel from Mouse click,Matlab gintput best example,Matlab get X and Y values form Image,Matlab gintput get X and Y values form Image

Monday, 9 April 2012

Matlab Video Processing : Read Avi File | Matlab convert video into JPG Frames



Video Processing is easy to process on Matlab but more memory needed.So videos are converted into Frames then apply all Image Processing techniques. here we give some example of video processing approach.In below we give matlab example for read avi files and converted into JPG Frames from avi file.

Code :

filename = "input.avi"
;

file=aviinfo(filename); % to get inforamtaion abt video file frm_cnt=file.NumFrames % No.of frames in the video file
h = waitbar(0,'Please wait...');

for i=1:frm_cnt

frm(i)=aviread(filename,i); % read the Video file

frm_name=frame2im(frm(i)); % Convert Frame to image file

filename1=strcat(strcat(num2str(i)),str2);
imwrite(frm_name,filename1); % Write image file

waitbar(i/frm_cnt,h)

end

close(h)


This code extract the video frames on current directory.

Related Search : Matlab Video Processing : Read Avi File , Matlab convert video into JPG Frames,Matlab read avi files examples,Matlab extract frames from video example code.

Thursday, 5 April 2012

Matlab ANFIS (Adaptive Neuro-Fuzzy Inference Systems) Example code | AnFis Matlab Example code

Anfis is one of the toolbox on matlab.Its most important on research works.Anfis is collaboration of Neural network and Fuzzy logic.Its mostly use in classification section.

In below we give some examples of Anfis on Matlab

In goto your matlab command window then type "anfisedit" then you sea editor of anfis.


In coding wise you have use following commands and syntax's.

Training Section code

input = [0 1 2 3 4 5 6 7 8 9]; % Input data
output = [1 1 1 1 1 2 2 2 2 2];% data class

trnData = [input' output'];

numMFs = 5;

mfType = 'gbellmf';

epoch_n = 20;
in_fis = genfis1(trnData,numMFs,mfType);
out_fis = anfis(trnData,in_fis,20);


then you sea following output


Testing a Anfis

Just use evalfis command.Its predefined function on matlab for evaluating a fuzzy.

>> evalfis(1,out_fis)
ans = 1.0000
>> evalfis(9,out_fis)
ans = 2.0000

'ans' is the output of anfis.

Related Search : Matlab anfis code example,Adaptive Neuro-Fuzzy Inference Systems Matlab code,Anfis matlab examples,Neuro-fuzzy matlab code,Neuro-fuzzyMatlab examples

Saturday, 31 March 2012

Matlab PSNR calculation Example code | Matlab Peak Signal to Noise Ration calcylation

Peak signal to noise ration calculation used as following areas,
  1. Image Compression
  2. Watermarking
  3. Signal processing
and more areas its used.PSNR Matlab code as follows

A = imread('input.jpg');
B = imread(output.jpg');

max2_A = max(max(A));
max2_B = max(max(B));
min2_A = min(min(A));
min2_B = min(min(B));

if max2_A > 255 || max2_B > 255 || min2_A < 0 || min2_B < 0
error('input matrices must have values in the interval [0,255]')
end

error_diff = A - B;
decibels = 20*log10(255/(sqrt(mean(mean(error_diff.^2)))));
disp(sprintf('PSNR = +%5.2f dB',decibels))


In above PSNR code only used in Image processing area.


Related Search : Matlab PSNR calculation Example code , Matlab Peak Signal to Noise Ration calcylation,PSNR matlab code.Matlab Image PSNR Calculation.

Tuesday, 20 March 2012

Multilevel 2-D Wavelet Decomposition Example code | Multilevel Matlab 2-D Wavelet examples

In below example to support for multilevel 2-D wavelet decomposition on Matlab.below syntax used to create your Multilevel 2-D Wavelet.

In matlab wavedec2 use this function for multilevel 2d- wavelet example as below.


>>N = 3; % 3-level 2d wavelet....
>>X = imread('input.jpg');
>>imshow(X);
>> [C,S] = wavedec2(X,N,'haar'); % we choosing haar wavelet.. C is band ,S is coefficients of bands

C is band value .Change bands values
In below we applying inverse multilevel 2d wavelet....

>>output = waverec2(C,S,'haar');
>>imshow(output);


Related Search : Multilevel 2-D Wavelet Decomposition Example code , Matlab 2-D Wavelet examples,Multilevel 2-D Wavelet Decomposition Matlab Example code , Multilevel Matlab 2-D Wavelet code,Multilevel haar wavelet Transform matlab code.

Single Level 2d Discrete Wavelet Transform Matlab Example code | Single Level 2d Wavelet Transform Code on Matlab

In below example to applying single level wavelet transform.

Wavelets are convert the signal into more sub bands like low frequency and high frequency. wavelets used in stenography and watermarking techniques.

>> input = imread('input.jpg');
>> imshow(input);
>>[LL,LH,HL,HH] = idwt2(input,'haar'); % here we use haar wavelet applying

then process and covert any one bands.then applying inverse operation,example as below

>>out_img = idwt2(LL,LH,HL,HH);
>>imshow(out_img );


Finally we construct new image.


Related Search : Single Level 2d Discrete Wavelet Transform Matlab Example code , Single Level 2d Wavelet Transform Code on Matlab,dwt2 matlab examples,dwt2 haar Wavelet Transformexamples,idwt2 matlab examples.
Related Posts Plugin for WordPress, Blogger...