DSPRelated.com
Forums

what is the difference btwn conv2 and filter2 in matlab?

Started by fulltime January 22, 2007
Hi,

I am trying to apply 2D FIR filters to an image. wat is the difference
btwn using conv2 and filter2?

When i use conv2, I can obtain an image of the same size as the
original image, but if i were to use filter2, the result is only a few
pixels.

another question is upon reading in an image using imread, do i need to
convert to ycbcr format before i perform the conv2 or filter2?

Urgent help is needed and any advice given is much appreciated.

Best Regards,
fulltime

fulltime wrote:
> Hi, > > I am trying to apply 2D FIR filters to an image. wat is the difference > btwn using conv2 and filter2? > > When i use conv2, I can obtain an image of the same size as the > original image, but if i were to use filter2, the result is only a few > pixels. > > another question is upon reading in an image using imread, do i need to > convert to ycbcr format before i perform the conv2 or filter2? > > Urgent help is needed and any advice given is much appreciated. > > Best Regards, > fulltime >
I don't use Matlab often anymore, but I remember using the 1-D equivalent functions, i.e. filter and conv. I believe the difference comes down to the number of samples in the output. For example let's say you have input x and impulse response h to give you an output y (with respective lengths len_x, len_h, len_y). When using the filter function len_y will be len_x, but when using the conv function then len_y will equal len_x+len_h-1. Brad