简体   繁体   中英

2D HAAR DWT on image with non even dimensions

How does 2d haar dwt work on images where one of dimensions or both dimensions are not even length. For example what abou image 511x511 pixels?

If dimension are even then it is straightforward. From 512x512 pixels we get 4 subbands with 256x256 pixels. Inverse 2d haar dwt will give us back 512x512 pixels image.

How does it work with non even dimensions?

I had a similar question, it appears there are two solutions.

One is to simply let the data size round when dividing by two. Eg. A classical transform would, starting at 8, work on data sizes 8, 4, 2. By rounding down, starting at 13 it would go: 14, 8, 4, 2 instead of 13 (error), 7 (error), etc.

An alternative I've just found is here:

http://people.sc.fsu.edu/~jburkardt/c_src/haar/haar.html

This effectively pads the data out to the largest power of two. However the C example will also overrun the input array when it is padded like this.

As to which is mathematically correct, I don't know. It seems like the rounding approach would introduce artifacts. Whilst the padding would add extra 'features'. Perhaps these could be minimized by padding with either the last value or a mean value?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM