Re: [LogoForum] Re: Focusing and "Unfocusing" pixels

This is a discussion on Re: [LogoForum] Re: Focusing and "Unfocusing" pixels within the logo forums in Programming Languages category; The message below is being cross-posted from the LogoForum. Please reply here at comp.lang.logo and it will be cross-posted back to the LogoForum. The original author of this message is Andreas.Micheler@gmx.nospam.de . Hallo Juan, In aUCBLogo-4.8 this will be possible: to test_imagefilter clearScreen im=loadImage "grass.jpg width=(BitMaxX im)+1 m=reRGBA toMatrix im ; simpleLowPass m FFTfilter m im2=(Bitmap RGBA m.1 m.2 m.3 m.4) BitPaste im2 end to simpleLowPass m filterstrength=2 repeat 2 [ for [i 1 4][m.i=lowpassFilter m.i filterstrength] for [i 1 4][m.i=transpose m.i] ] end to FFTfilter m for [i 1 3][m.i=FFT m.i] mx=MatrixWidth m.1 my=MatrixHeight m.1 x0=int mx/2 y0=int my/2 ...

Go Back   Application Development Forum > Programming Languages > logo

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-03-2008, 08:06 AM
John St. Clair
Guest
 
Default Re: [LogoForum] Re: Focusing and "Unfocusing" pixels

The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
Andreas.Micheler@gmx.nospam.de.



Hallo Juan,

In aUCBLogo-4.8 this will be possible:
to test_imagefilter
clearScreen
im=loadImage "grass.jpg
width=(BitMaxX im)+1
m=reRGBA toMatrix im
; simpleLowPass m
FFTfilter m
im2=(Bitmap RGBA m.1 m.2 m.3 m.4)
BitPaste im2
end

to simpleLowPass m
filterstrength=2
repeat 2
[ for [i 1 4][m.i=lowpassFilter m.i filterstrength]
for [i 1 4][m.i=transpose m.i]
]
end

to FFTfilter m
for [i 1 3][m.i=FFT m.i]
mx=MatrixWidth m.1
my=MatrixHeight m.1
x0=int mx/2
y0=int my/2
r=int mx/5
Home
setFloodColor RGB 0 0.2 0.5
fillRect (list -x0 -y0)(list x0 y0)
setFloodColor rgb 1 1 1
PenUp
setXY x0 y0 fillCircle r
setXY x0 -y0 fillCircle r
setXY -x0 y0 fillCircle r
setXY -x0 -y0 fillCircle r
bm=BitCopy mx my
bm=BitResize bm mx my
BitMakeTransparent bm 0
mask=Array 3
mask.1=(Float (BitAnd (Array bm) 255))/255
mask.2=(Float (BitAnd LShift (Array bm) -8 255))/255
mask.3=(Float (BitAnd LShift (Array bm) -16 255))/255
for [i 1 3][m.i=(toMatrix (Array m.i)*mask.i)]
for [i 1 3][m.i=invFFT m.i]
setXY x0+10 -100
end

to zero_circle m
for [y -r r]
[ for [x -r r]
[ if (sqrt x*x+y*y) < r
[ ix=saturateAbove mx saturateBelow 1 x+x0
iy=saturateAbove my saturateBelow 1 y+y0
m.ix.iy=0
]
]
]
end

This already works here, :-)
but I have problems with the stability of aUCBLogo-4.8,
the checks dont pass, so I cannot upload it yet.

The FFTfilter routine multiplies the spectrum of the image with a mask,
which is generated simply by drawing.
The mask is split in the three color channels.
So you can generate pretty much any FFT image filter effect. :-)

Cheers,
Andreas
__._,_.___
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum
Reply With Quote
  #2  
Old 03-03-2008, 08:09 AM
John St. Clair
Guest
 
Default Re: [LogoForum] Re: Focusing and "Unfocusing" pixels

The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
pavel@elica.nospam.net.


Andreas Micheler wrote:
> This already works here, :-)
> but I have problems with the stability of aUCBLogo-4.8,
> the checks dont pass, so I cannot upload it yet.


A snapshot would be highly appreciated

By the way, does FFT in your code stand for Fast Fourier Transformation
or there is just a coincidence of acronyms?

Pavel



> The message below is being cross-posted from the LogoForum. Please
> reply here at comp.lang.logo and it will be cross-posted back to the
> LogoForum. The original author of this message is
> Andreas.Micheler@gmx.nospam.de.
>
>
>
> Hallo Juan,
>
> In aUCBLogo-4.8 this will be possible:
> to test_imagefilter
> clearScreen
> im=loadImage "grass.jpg
> width=(BitMaxX im)+1
> m=reRGBA toMatrix im
> ; simpleLowPass m
> FFTfilter m
> im2=(Bitmap RGBA m.1 m.2 m.3 m.4)
> BitPaste im2
> end
>
> to simpleLowPass m
> filterstrength=2
> repeat 2
> [ for [i 1 4][m.i=lowpassFilter m.i filterstrength]
> for [i 1 4][m.i=transpose m.i]
> ]
> end
>
> to FFTfilter m
> for [i 1 3][m.i=FFT m.i]
> mx=MatrixWidth m.1
> my=MatrixHeight m.1
> x0=int mx/2
> y0=int my/2
> r=int mx/5
> Home
> setFloodColor RGB 0 0.2 0.5
> fillRect (list -x0 -y0)(list x0 y0)
> setFloodColor rgb 1 1 1
> PenUp
> setXY x0 y0 fillCircle r
> setXY x0 -y0 fillCircle r
> setXY -x0 y0 fillCircle r
> setXY -x0 -y0 fillCircle r
> bm=BitCopy mx my
> bm=BitResize bm mx my
> BitMakeTransparent bm 0
> mask=Array 3
> mask.1=(Float (BitAnd (Array bm) 255))/255
> mask.2=(Float (BitAnd LShift (Array bm) -8 255))/255
> mask.3=(Float (BitAnd LShift (Array bm) -16 255))/255
> for [i 1 3][m.i=(toMatrix (Array m.i)*mask.i)]
> for [i 1 3][m.i=invFFT m.i]
> setXY x0+10 -100
> end
>
> to zero_circle m
> for [y -r r]
> [ for [x -r r]
> [ if (sqrt x*x+y*y) < r
> [ ix=saturateAbove mx saturateBelow 1 x+x0
> iy=saturateAbove my saturateBelow 1 y+y0
> m.ix.iy=0
> ]
> ]
> ]
> end
>
> This already works here, :-)
> but I have problems with the stability of aUCBLogo-4.8,
> the checks dont pass, so I cannot upload it yet.
>
> The FFTfilter routine multiplies the spectrum of the image with a mask,
> which is generated simply by drawing.
> The mask is split in the three color channels.
> So you can generate pretty much any FFT image filter effect. :-)
>
> Cheers,
> Andreas
> __._,_.___
> LogoForum messages are archived at:
> http://groups.yahoo.com/group/LogoForum

Reply With Quote
  #3  
Old 03-03-2008, 08:12 AM
John St. Clair
Guest
 
Default Re: [LogoForum] Re: Focusing and "Unfocusing" pixels

The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
Andreas.Micheler@gmx.nospam.de.


Hallo Pavel!

> Andreas Micheler wrote:
>> This already works here, :-)
>> but I have problems with the stability of aUCBLogo-4.8,
>> the checks dont pass, so I cannot upload it yet.


>A snapshot would be highly appreciated


Here's a screenshot:
<http://www.physik.uni-augsburg.de/~micheler/aUCBLogo_Screenshot6.png>

>By the way, does FFT in your code stand for Fast Fourier Transformation
>or there is just a coincidence of acronyms?


Yes, it's done with a Fast Fourier Transformation.
aUCBLogo uses the FFTW library.
I also use it in some audio analysis Logo programs. :-)

Cheers,
Andreas


> The message below is being cross-posted from the LogoForum. Please
> reply here at comp.lang.logo and it will be cross-posted back to the
> LogoForum. The original author of this message is
> pavel@elica.nospam.net.
>
>
> Andreas Micheler wrote:
> > This already works here, :-)
> > but I have problems with the stability of aUCBLogo-4.8,
> > the checks dont pass, so I cannot upload it yet.

>
> A snapshot would be highly appreciated
>
> By the way, does FFT in your code stand for Fast Fourier Transformation
> or there is just a coincidence of acronyms?
>
> Pavel
>
>
>
> > The message below is being cross-posted from the LogoForum. Please
> > reply here at comp.lang.logo and it will be cross-posted back to the
> > LogoForum. The original author of this message is
> > Andreas.Micheler@gmx.nospam.de.
> >
> >
> >
> > Hallo Juan,
> >
> > In aUCBLogo-4.8 this will be possible:
> > to test_imagefilter
> > clearScreen
> > im=loadImage "grass.jpg
> > width=(BitMaxX im)+1
> > m=reRGBA toMatrix im
> > ; simpleLowPass m
> > FFTfilter m
> > im2=(Bitmap RGBA m.1 m.2 m.3 m.4)
> > BitPaste im2
> > end
> >
> > to simpleLowPass m
> > filterstrength=2
> > repeat 2
> > [ for [i 1 4][m.i=lowpassFilter m.i filterstrength]
> > for [i 1 4][m.i=transpose m.i]
> > ]
> > end
> >
> > to FFTfilter m
> > for [i 1 3][m.i=FFT m.i]
> > mx=MatrixWidth m.1
> > my=MatrixHeight m.1
> > x0=int mx/2
> > y0=int my/2
> > r=int mx/5
> > Home
> > setFloodColor RGB 0 0.2 0.5
> > fillRect (list -x0 -y0)(list x0 y0)
> > setFloodColor rgb 1 1 1
> > PenUp
> > setXY x0 y0 fillCircle r
> > setXY x0 -y0 fillCircle r
> > setXY -x0 y0 fillCircle r
> > setXY -x0 -y0 fillCircle r
> > bm=BitCopy mx my
> > bm=BitResize bm mx my
> > BitMakeTransparent bm 0
> > mask=Array 3
> > mask.1=(Float (BitAnd (Array bm) 255))/255
> > mask.2=(Float (BitAnd LShift (Array bm) -8 255))/255
> > mask.3=(Float (BitAnd LShift (Array bm) -16 255))/255
> > for [i 1 3][m.i=(toMatrix (Array m.i)*mask.i)]
> > for [i 1 3][m.i=invFFT m.i]
> > setXY x0+10 -100
> > end
> >
> > to zero_circle m
> > for [y -r r]
> > [ for [x -r r]
> > [ if (sqrt x*x+y*y) < r
> > [ ix=saturateAbove mx saturateBelow 1 x+x0
> > iy=saturateAbove my saturateBelow 1 y+y0
> > m.ix.iy=0
> > ]
> > ]
> > ]
> > end
> >
> > This already works here, :-)
> > but I have problems with the stability of aUCBLogo-4.8,
> > the checks dont pass, so I cannot upload it yet.
> >
> > The FFTfilter routine multiplies the spectrum of the image with a mask,
> > which is generated simply by drawing.
> > The mask is split in the three color channels.
> > So you can generate pretty much any FFT image filter effect. :-)
> >
> > Cheers,
> > Andreas
> > __._,_.___
> > LogoForum messages are archived at:
> > http://groups.yahoo.com/group/LogoForum

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 01:42 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.