Lazy cat's Home Page

Please listen to my guitar play!! click here
Lazy cat's You Tube page

This page's contents are picture zooming and rotation.

DCT,Lanczos3,Hybrid Picture interporation software

Download Here

How to use

This homepage has file size limit. Then killed this file. This file is moved to Zuruyaumineko's homepage2's final place.

1.The digital picure zooming

    We know the words that are resize,resample,scaling,interporation,resolution conversion,decimation and resampling. All of these words are keywords of picture size conversion.

   1.1.Zooming on space area

We know the algorithm called Lanczos 3-lobed sinc filtered interporation and decimation. I show an explanation by the sampling theorem as follows. the following explanation is how to resize digital picture(included lanczos 3 resize). Principle of resize

Following explanation is four fifth decimation.

The function type sin(x)/x is called sinc function. It is the symboll of Sampling theorem. When the parameter 'a' of function sin(ax)/ax becomes smaller and smaller,this function's filter characteristic is lower and lower frequency pass. digital picture decimation is to convolute sinc function to picture sample and subsample some pixels. When we decimate pictures,their high frequency components are lost. if we shrink picture to one pixel picture,it has only direct current component ie. average of all pixels of this picture. decimation is band limitting. Rational decimation is poly-phase finite impulse response filtering whose coefficients be changed step by step as above figure. Next figures are why poly phase FIR filter is needed for rational decimation.

How to get the the interpolated value of arbitrary position (Explanation of the sampling theorem)

   1.2.Zooming on space frequency area

I show on next links C program source lists which is the even functional DFT resizer and DCT resizer.

if you want to resize bitmap digital picture with higher quality than lanczos 3-lobed sinc filter algorithm, please use it. They use the most nearest to ideal Low Pass Filter. We can select arbitrary integer horizontal size and integer vertical size. Even functional DFT resizer is later than DCT resizer on function end time. I show the reason why these resize algorithm is high quality on following figure.principle of resize 2

BMP arbitrary size interpolator C sourceby Even functional DFT

BMP arbitrary size decimator C source by Even functional DFT

BMP arbitrary size interpolator C source by DCT

BMP arbitrary size decimator C source by DCT

I made execute file on windows command prompt of BMP arbitrary size interpolator.


DCT_UP_RESIZE2 -i nantyara.bmp -o kakudai(.bmp extension no need)-sizexminus (horizontal size difference between before and after. when 640->720, value 80)-sizexminusy (vertical size difference between before and after. when 400->480, value 80)


When gazou.bmp with 320x180 changes to kakudai.bmp with 400x200 on C drive, as follow.

copy DCT_UP_RESIZE2.exe and gazou.bmp on c:\

C:\>DCT_UP_RESIZE2 -i gazou.bmp -o kakudai -sizexminus 80 -sizexminusy 20 kakudai.bmp will be generated on c:\

BMP arbitrary interpolation by dct execute file download

next decimation version


DCT_DOWN_RESIZE -i nantyara.bmp -o syukusyou(.bmp extension no need)-sizexminus (horizontal size difference between before and after.When 720->640,value 80)-sizexminusy (vertical size difference between before and after.When 480->400, value 80)

When gazou.bmp with 400x200 changes to syukusyou.bmp with 320x180 on C drive,as follow.

copy DCT_DOWN_RESIZE.exe and gazou.bmp on c:\

C:\>DCT_DOWN_RESIZE -i gazou.bmp -o syukusyou -sizexminus 80 -sizexminusy 20 syukusyou.bmp will be generated on c:\

BMP arbitrary decimation by dct execute file download

Source picture 640x480
DCT decimate 376x282
DCT interpolate 800x600

zone plate decimation

Source 720x480

DCT decimate 640x420

DCT decimate 352x288 CIF When stripe interval becomes less 1 pixel, color becomes grey. That is filter effect.

2.Picture rotate

    I show only C source list. I give two softwares. One is adding picture frame. The other is rotation function. rotation algorithm is bilinear method .

Adding picture frame C program source list

picture rotation C program source list

I made the execute file of adding picture frame on command prompt.


GAKUBUTI -i nantyara.bmp -o gakubuti(.bmp extention no need and picture size will be added to file name)


When gazou.bmp with 320x180 changes ???x???_gakubuti.bmp on C drive, as follows

copy GAKUBUTI.exe and gazou.bmp on c:\.

C:\>GAKUBUTI -i gazou.bmp -o gakubuti ???x???_gakubuti.bmp will be generated on C:\.

BMP adding picture frame execute file download

Rotation Software


rotate -i nantyara.bmp -o kaiten(.bmp extention no need and picture size will be added to file name)


When 400x400_gakubuti.bmp with 400x400 changes to 400x400_kaiten.bmp on c drive, as follows

copy rotate.exe and 400x400_gakubuti.bmp on c:\.

C:\>rotate -i 400x400_gakubuti.bmp -o kaiten 400x400_kaiten.bmp will be generated on c:\.

BMP picture rotation execute file download

rotate 30 degree
rotate 125 degree


Space area resize is close relation to Space frequency area resize.
You will find a difficulty on the space area resize.
The difficulty is that pixels for left half taps don't exist when we filter by FIR on left side end pixels.
How do we do ?
The answer is that we put a mirror on left side end pixel.
And we filter to the mirror image pixels.
So right side end pixels , top side end pixels and bottom side end pixels are done in the same way.
These way are essentially the same as DCT resize technique.

--The difference between DFT and DCT with same number of samples--

DCT has twice frequency resolving power than DFT with same number of samples.
So in the result of DCT, we get only data which is less than nyquist frequency.
We can twice frequency resolving power than normal DCT.
The way is that we arrange same N sample after N sample and DCT to the 2xN samples.
In the same way, 4xN ,8xN and etc.
So frequency sampling interval can be shorter than normal DCT.

About Quantize

Quantize from 24bit color to 3bit color.
@Caliculate each R,G and B histgrams from R,G,B all pixel values.
They are from pixel value 0 to pixel value 255.
R is 256 kind,G is 256 kind and B is 256 kind.

ADifinit M half of all pixels number.

BDifinit H maximum pixel value of the picture.

CDifinit L minimum pixel value of the picture.

DDivide in two at M on each of R,G and B. and make 8 areas.

EcCaliculate the centers of gravity of each 8 areas

FDo Floyd & Steinberg error diffusion.


3bit quantization


3bit quantization

program source of 3bit error diffusion on BMP picture

pictures of DCT resize and Even Functional DFT resize

DCT 2/5 decimation
Even Functional DFT 2/5 decimation
A little different but look like same.

Lanczos3 space area resize 2/5 decimation
Lanczos3 is beautiful.

binarisation Ohtsu's method

binarization by Ohtsu's method

1bit quantization F&S error diffusion

1bit quantization by error diffusion F&S

Same quality as DCT resize but space area decimation resize source code (ideal filter)

Same quality as DCT resize but space area interpolation resize source code(ideal filter)

space area ideal filter 2/5 decimation

DCT 2/5 decimation

next (Japanese Only ,sorry) Zuruyaumineko's homepage2

Special Thanks to Dr. Ken Turkowski, Ohio University, Dr. Kazuo Toraichi, Mr. Kazuhiro Mogi, ,my wife and my daughter.

revised on April,27th,2008 error diffusion,binarization and picture samples shows

Chiba University graduation in 1986
Takashi Nakajima

If you have questuion,please mail to me.

現在の閲覧者数: Return to Top

inserted by FC2 system