2.0

2.0 | 5 ratings Rate this file 568 downloads (last 30 days) File Size: 122.3 KB File ID: #22233

Demirel Edge Detector

by Shahab Anbarjafari

 

24 Nov 2008

A new fast and cool edge detector!

I am interested in collaboration

Download Now | Watch this File

File Information
Description

This programme has been written by me, G. Anbarjafari (Shahab) months ago but I finalized today 17-11-2008 and Assoc. Prof. Dr. Hasan Demirel and I decided to post it now 17/11/2008.For any question feel free to write contact us via one of the following email addresses:  
hasan.demirel[at]emu.edu.tr  
shahab.jafari[at]emu.edu.tr  
As a test, copy all the files in your wanted directory, e.g. work directory of MATLAB, and then run the following lines:  
>> z=imread('binary2.jpg');  
>> h=demireledge(z,0.25,1);  
>> imshow(z);figure;imshow(h)  
Enjoy the programme.  
 
(c) Demirel and Anbarjafari - 2008  
Eastern Mediterranean University  
http://faraday.ee.emu.edu.tr/hdemirel  
http://faraday.ee.emu.edu.tr/shahab

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files DemirelEgde/demirel.m,
DemirelEgde/ReadMe.txt,
DemirelEgde/Cover_DemirelEdge.bmp,
DemirelEgde/Me_and_Dr_Demirel.jpg,
DemirelEgde/Binary.jpg,
DemirelEgde/demireledge.m,
DemirelEgde/
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
25 Nov 2008 Dr Anonymous I did not look at the code. But self-rating, though not immediately obvious, is considered not appropriate here.
25 Nov 2008 Dr Anonymous Hi Shabab, 
 
same happened to me once. The immediate submission of a rating by just clicking one of the stars is really annoying.  
 
Still, I looked at your files and there are some things I want to address. 
 
First, there are no H1-lines. This first line in your function help block is supported by the function lookfor.  
 
Second, what is the function demireledge good for except that it passes the variables to demirel , clears the variable memory (what do you want to do with the command clear memory?), if there is any, and clears your command window.  
 
Third, I look at the function demirel. The function syntax in the help text does not say anything of a third input variable T, which, however, is required to run the function. demirel applies edge detection to binary images, but allows for rgb images, too, by simply converting them to grayscale with the function rgb2gray and then to binary with im2bw. You should refer to this mechanism in your help text. 
 
When you create the Kernel, you apply the variable T. What, if the user supplies a thickness of 0.1? Check the validity of this input argument. 
 
After filtering the bw image with a cross shaped kernel, you set elements in the result Q to zero, if they are less than 1. You accomplish this by  
Q([find(Q<1)])=0; 
Since logical indexing is allowed, it would be totally sufficient and more effective to write 
Q(Q<1) = 0; 
But, do you expect any values to be below 1? Given the Kernel and the bw image, this will not occur. 
 
Instead of line 24-27, I'd just write 
h = Q>0 & ~im1; 
and return h as a logical matrix. 
 
At the end, you apply edge detection to a logical matrix. You calculate edges with specified thickness around objects previously simply identified by thresholding a gray scale image. 
 
What is new about it to give it the name demirel edge detection detection?  
25 Nov 2008 Shahab Anbarjafari Halo!  
 
>>First, there are no H1-lines....  
I am not so sure if I got what you mean!  
 
>>Second, what is the function....  
I previously wrote a .p file and function demireledge was calling that .p file, but as you know we can upload .p-file so I didn't remove that function.  
 
>>Third, I look at the function demirel....  
As I have provided the whole code, so I found it redundant to mentioned those basic functions in the help, although you are right, and in the previous edition of this programme (when I was thinking of submitting .p file) I actually mentioned those functions in the help!  
 
I will implement your comments in the newer edition of the file soon :-)  
 
>>What is new about it to give it the name demirel edge detection, detection?  
Well I guess it is clear that the methodology is new! And it was interesting that such easy operations leads to a nice edge detection technique! So the whole thing is new but simple, so I thought it deserve a new name! Actually my supervisor, Dr. Hasan Demirel, and I have actually used this technique for some other research which I might be references them in the near future.  
 
Best  
Shahab
25 Nov 2008 Dr Anonymous Hi Shabab, 
 
no, it's not new. I'd not even call it edge detection. Your code identifies objects simply by grayscale to bw image conversion using a threshold. Identifying the edge around objects in a logical matrix is really trivial. Look at the function bwperim. It does what your function does except one but important difference. 
 
bwperim 
"A pixel is part of the perimeter if it is nonzero and it is connected to at least one zero-valued pixel." 
 
the output of your function could be described as 
"A pixel of the output is part of the edge if it is zero and it is connected to at least one one-valued pixel." + that you can enhance the width of the edge. 
 
So what is an edge? The inner perimeter or the outer perimeter of an object? Your function returns the outer perimeter of objects and it should be named so. 
 
Would that be new? No. See for example 
http://www.mathworks.com/matlabcentral/fileexchange/12303
30 Nov 2008 i posh  
01 Dec 2008 Dr Anonymous Dear i posh, 
 
you seem to be a real fan of Shabab. Three ratings on one day. All of them on Shabab's files, all with a four rating.  
http://www.mathworks.com/matlabcentral/fileexchange/authors/37751 
Well, I have a suspicion who i posh is. Nice try, but not well done. 
 
One star from me.
01 Dec 2008 Shahab Anbarjafari As I said in other comment he is one of my students! I really can't stop them doing so!!!!! I hardly care about rating! I have much more important things to do! Anyway, I will post a new version of the DemirelEdge detection, so you may have a look at that one, I will try to make the help and comments better.  
Best  
Shahab
16 Dec 2008 Manuel Matías Not an edge detector as the title says.
Please login to add a comment or rating.

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com