Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!news.aset.psu.edu!support1.mathforum.org!not-for-mail
From: Yumnam Kirani Singh <kirani.singh@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Image filters,Edge detectors
Date: Wed, 09 Jan 2008 00:39:18 EST
Organization: The Math Forum
Lines: 10
Message-ID: <30435824.1199857189457.JavaMail.jakarta@nitrogen.mathforum.org>
References: <92c92442-41d6-4901-a21c-6b0eb85dd0cd@f47g2000hsd.googlegroups.com>
NNTP-Posting-Host: nitrogen.mathforum.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: support1.mathforum.org 1199857189 22798 144.118.30.135 (9 Jan 2008 05:39:49 GMT)
X-Complaints-To: news@support1.mathforum.org
NNTP-Posting-Date: Wed, 9 Jan 2008 05:39:49 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:444981


The difference between the filter2 and conv2 are that in filter2, the filter mask in not flipped left right. you can get the same result when you call filter2 with its filter mask flipped left right. For example,

>> xf=filter2(x, fliplr(mask)); % filter2 as conv2
>> xc=conv2(x,mask);
Then xc and xf will be the same. Actually we do not need the filter2 and conv2 in MATLAB, since we can use filter2 as conv2 or conv2 as filter2 just by fliping the mask.
>> xc=conv2(x, fliplr(mask)); % conv2 as filter2
>> xf=filter2(x,mask);
here also, xc and xf will give the same result. 

conv2 or filter2 is generalized function which can used for various filtering operation. Edge is a function specially designed for detecting edges in an image using only the known edge detection filters, such as prewitt, sobel, lapalcian of gausssian etc. One cannot use edge as a filtering operator with a different filter mask. Also, it return a binary image with black ground after removing the probable non edge regions and linking the probale edges in an image. In the case conv2 or filter2 the output is not a binary image. They are used as filtering operation in edge. After this, thresholding, thiniing and  edge linking operations are applied to return binary image as ouput in edge.