4.0

4.0 | 3 ratings Rate this file 52 Downloads (last 30 days) File Size: 42.56 KB File ID: #20666
image thumbnail

shape recognition(many shape)

by Trieu Nguyen Ta

 

11 Jul 2008 (Updated 11 Jul 2008)

with this you can recognize many shape;but only symetrical shape

| Watch this File

File Information
Description

with this you can recognize many shape;but only symetrical shape,for example you can improve this for recognize star,polygon if you want

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
13 Jul 2008 Trieu Nguyen Ta

i'm so sorry becauce i upload file in vietnamese,but now if u don't understant anything u can contact with me,so i can explain it for u,

01 Feb 2009 Lee

Hi, can you please explain all the vietnamese words in the programme? such as dolech, tamgiacdeu ,elip, thoi etc. Thank you very much.

08 Oct 2009 kidare

Bác có suorce code nhận dạng ảnh bằng mạng nơtron ko ạ?source này ko sử dụng mạng nơtron thì phải

22 Nov 2009 phuc minh

>> i1=imread('E:\ELECTRONICS SOFTWARE\matlab\mau\tamgiac.png');
>> i2=imread('E:\ELECTRONICS SOFTWARE\matlab\mau\tugiac.png');
>> i3=imread('E:\ELECTRONICS SOFTWARE\matlab\mau\tron.png');
>> im1=im2bw(i1);
>> im2=im2bw(i2);
>> im3=im2bw(i3);
>> p1=reshape(im1,1,176);
>> p2=reshape(im2,1,176);
>> p3=reshape(im3,1,176);
>> p=[p1 p2 p3];
>> t=[1 2 3];
>> %lay du lieu
net=newff(minmax(p),[176,20,7],{'logsig','logsig','purelin'},'traingd');
net.trainParam.epochs=10000;
net.trainParam.goal=0.00000001;
%[net,tr]=train(net,p,t);
[net,tr]=train(net,p,t)
??? Error using ==> minmax at 43
Argument has illegal type.
cuold you help me, please?
what is this error ?

06 May 2010 abhi m

I should recognise circle square rectangle but am struck... the code below is effecient in recognising circle but it is failing to recognise square and recatngle.. plz help me in improvising my code plz....

rgbImage = imread('test.jpg');
[rows columns numberOfColorBands] = size(rgbImage);
subplot(3, 2, 1);
imshow(rgbImage, []);
title('Original color Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

%STEP 2

%---------------------------------------------------Convert rgb image to grayscale-----------------------------------------

grayImage = rgb2gray(rgbImage);
subplot(3, 2, 2);
imshow(grayImage, []);
title('Converted to gray scale');

%STEP 3

%------------------------------------------------------Detection of edge by canny-------------------------------------------------------

cannyImage = edge(grayImage,'canny');
subplot(3, 2, 3);
imshow(cannyImage, []);
title('Canny Edge Image');

%STEP 4

%-------------------------------------------------------------dilation--------------------------------------------------------

windowSize = 5;
halfWidth = floor(windowSize/2);
dilatedImage = zeros(rows, columns);
for col = (halfWidth+1) : columns - halfWidth
    x1 = col - halfWidth;
    x2= col + halfWidth;
    for row = (halfWidth+1) : rows - halfWidth
        y1 = row - halfWidth;
        y2 = row + halfWidth;
        dilatedImage(row, col) = max(max(cannyImage(y1:y2, x1:x2)));
    end
end

%Displaying the dilated image

subplot(3, 2, 4);
imshow(dilatedImage, []);
caption = sprintf('Dilated with a window size of %d',windowSize);
title(caption);

%STEP 5

%------------------------------------------------------------Erosion-------------------------------------------------

windowSize = 5;
halfWidth = floor(windowSize/2);
erodedImage = zeros(rows, columns);
for col = (halfWidth+1) : columns - halfWidth
    x1 = col - halfWidth;
    x2= col + halfWidth;
    for row = (halfWidth+1) : rows - halfWidth
        y1 = row - halfWidth;
        y2 = row + halfWidth;
        erodedImage(row, col) = min(min(dilatedImage(y1:y2, x1:x2)));
    end
end

%Displaying eroded image

subplot(3, 2, 5);
imshow(erodedImage, []);
caption = sprintf('Eroded image with a window size of %d',windowSize);
title(caption);
[B,L] = bwboundaries(grayImage, 'noholes');

STATS = regionprops(L, 'all');

figure,
imshow(grayImage),
title('Results');
hold on
for i = 1 : length(STATS)
  W(i) = uint8(abs(STATS(i).BoundingBox(3)-STATS(i).BoundingBox(4)) < 0.1);
  W(i) = W(i) + 2 * uint8((STATS(i).Extent - 1) == 0 );
  centroid = STATS(i).Centroid;
  switch W(i)
      case 1
          plot(centroid(1),centroid(2),'wO');
          title('circle');
      case 2
          plot(centroid(1),centroid(2),'wX');
          title('rectangle');
      case 3
          plot(centroid(1),centroid(2),'wS');
          title('square');
  end
end
return

08 May 2010 abhi

Hi, can u plz tel wt is this khoangcach{k}(1,i) = sqrt ( ( b(i,2) - s(k).Centroid(1) )^2 + ( b(i,1) - s(k).Centroid(2) )^2 );

29 Sep 2011 Luz

its a very good job.
although I have some questions . Please could you explain these khoangcach{k}(1,i) = sqrt ( ( b(i,2) - s(k).Centroid(1) )^2 + ( b(i,1) - s(k).Centroid(2) )^2 )

vuong = c/(4*b^2)
    chunhat=c/(4*b*(a^2-b^2)^0.5);

thnks a lot

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
application Trieu Nguyen Ta 22 Oct 2008 10:09:51
recognition Trieu Nguyen Ta 22 Oct 2008 10:09:51
shape Trieu Nguyen Ta 22 Oct 2008 10:09:51
many Trieu Nguyen Ta 22 Oct 2008 10:09:51
star Trieu Nguyen Ta 22 Oct 2008 10:09:51
polygon Trieu Nguyen Ta 22 Oct 2008 10:09:51
symmetrical Trieu Nguyen Ta 22 Oct 2008 10:09:51
shape avis m 29 Dec 2009 05:16:15
symmetrical Manoj Kumar 06 Jul 2011 00:16:20
star Manoj Kumar 06 Jul 2011 00:16:23
shape Manoj Kumar 06 Jul 2011 00:16:27
recognition Manoj Kumar 06 Jul 2011 00:16:29
polygon Manoj Kumar 06 Jul 2011 00:16:31
many Manoj Kumar 06 Jul 2011 00:16:33
application Manoj Kumar 06 Jul 2011 00:16:36
application roozbeh 04 Aug 2011 13:58:53

Contact us at files@mathworks.com