Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Blurring with mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54814] Blurring with mathematica
  • From: V.Marinakis at damtp.cam.ac.uk
  • Date: Wed, 2 Mar 2005 22:29:04 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear all,

I have some questions regarding the following email:
1) Shouldn't it be the factor (1/Sqrt[2 Pi sdev^2]) in the kernel?
2) What should I change in order to normalise the gaussian to an interval
of 1;

Best, Vangelis Marinakis.


--------------------------------------------------------------------

Generate an image.

image = Table[Random[], {128}, {128}];
Show[Graphics[Raster[image]], AspectRatio -> 1];

Generate a Gaussian blurring kernel.

halfwindow = 5;
sdev = 2;
kernel = Table[Exp[-((i^2 + j^2)/(2*sdev^2))],
    {i, -halfwindow, halfwindow}, {j, -halfwindow, halfwindow}];
Show[Graphics[Raster[kernel]], AspectRatio -> 1];

Blur the image.

image2 = ListCorrelate[kernel, image];
image2 /= Max[image2];
Show[Graphics[Raster[image2]], AspectRatio -> 1];

If you want to blur with circular wraparound then use

ListCorrelate[kernel, image,
{{halfwindow + 1, halfwindow + 1},
{halfwindow + 1, halfwindow + 1}}];
Steve Luttrell

<V.Marinakis@[EMAIL PROTECTED]
> wrote in message 
news:cvrqhi$p5c$1@[EMAIL PROTECTED]
> Hello everyone.
>
> I have an image which is stored as an 128 times 128
> matrix and I want to add gaussian blurring. Does anyone
> know how can this be done with mathematica?
>
> Best, Vangelis Marinakis.
>



  • Prev by Date: FindRoot/NDSolve problem in VS5
  • Next by Date: Re: Bug in Import?
  • Previous by thread: Re: Re: Blurring with mathematica
  • Next by thread: Re: Blurring with mathematica