PDA

View Full Version : Bitmaps in VC


bergi
27th September 2002, 12:05
I want to test my new picture compression in windows. I've already test it in dos using allegro for bitmap reading, but now it want to test it in vc, but how can i read and write bitmaps in windows and something like putpixel and getpixel?

-h
27th September 2002, 12:37
I'm not sure (never had to). But I am curious about your compression method :)

Any hints as to what model you're basing it on?

-h

bergi
27th September 2002, 13:10
I'm using wavelets and huff, with a simple trick:
1. Do wavelet transform ca. 3 levels
2. Create huff tree
3. Sort values by frequency
4. Low frequency -> set value to nearest neighbour

Nic
28th September 2002, 10:16
Hi Bergi..

I cant remember off the top of my head, but you could create a CDC or (HDC)...use CreateCompatibleBitmap which will give you a pointer to the bits of the bitmap & just load them in that way. Then use the CDC->SelectObject(your hbitmap) & then use the CDC/HDC (GDI) functions to draw, get/set pixels, etc.

Sorry for being vague, ive got source code somewhere for that sort of thing, if your still stuck on monday ill post some :)

-Nic

ps
There are far better ways of loading a bitmap in though. Check out CBitmap's functions, etc :)

-h
28th September 2002, 17:13
You might want to check out the source to Maven's wavelet compressor (http://www.maven.de/code/index.html#wavelet). It displays bitmaps, compresses lossless/lossy via wavelets, etc.

-h

SirDavidGuy
28th September 2002, 23:12
4. Low frequency -> set value to nearest neighbour

You sure about this?

It will have the same effect as blurring the image before processing, but will take more processing time.

bergi
30th September 2002, 15:01
You sure about this?
I think you don't understand me, but this can also be reason of my band english.

Here what i think

this is a little part of my table of high frequences sorted by value, val is the value after wt, freq how many times it was found and bits the n'th node after the root. Look at the arrows these values are only different of one, so take middle and strike the others. There are no values between -105 and -111 so it should be better than quant by 2^n an only write the important bits.

val:-120 freq:1 bits:19
val:-119 freq:1 bits:19 <
val:-118 freq:4 bits:17 <--
val:-117 freq:1 bits:19 <
val:-116 freq:1 bits:19
val:-115 freq:1 bits:19
val:-114 freq:2 bits:18
val:-113 freq:2 bits:18
val:-112 freq:2 bits:18
val:-111 freq:2 bits:18
val:-105 freq:1 bits:19 <
val:-104 freq:1 bits:19 <--
val:-103 freq:1 bits:19 <
val:-100 freq:2 bits:18

SirDavidGuy
5th October 2002, 03:19
I think you don't understand me, but this can also be reason of my band english.

I pretty much get what you're saying (I think).

But you forget that wavelets have a much bigger relationship to the spatial domain than do sums of Cosines. Replacing each wavelet with the average of it and it's nearest neighboor (which is what I think you're trying to express, right?) will have the same effect of blurring the image in the pure-spatial domain. The only difference is that blurring in the wavelet domain will take longer.