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:
As a test, copy all the files in your wanted directory, e.g. work directory of MATLAB, and then run the following lines:
Enjoy the programme.
Grow up, any1 can write such an easy function. How dare you make your own edge detector?
Rename it to "outerperim" or something like this or ... just remove it.
Try this and you will see, that this is not an edge detector.
A = repmat(linspace(0,1,200),400,2);
h = demirel(A,0.5,1);
subplot(1,2,1); imshow(A); title('One edge in the original image')
title('mmmh...three edges here... strange... Why?')
Not an edge detector as the title says.
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.
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.
"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
>>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.
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
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?
I did not look at the code. But self-rating, though not immediately obvious, is considered not appropriate here.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.