Scaling an image in C

I am creating a jpeg for a bmp decoder that scales the image. I got the source code for the decoder, so my actual work is to design the scaling. I don't know where to start. I've researched the internet for various scaling algorithms but don't know where to introduce scaling. So should I do the scaling after converting the image to bmp or should I do it while decoding at the MCU level. I'm confused: (

If you have any information to help me, it is appreciated. any reading material, source code for analysis, etc.

Oh, I forgot to mention one more, this is a pc to fpga porting project, so not all library files are available on the target platform.

+2


a source to share


1 answer


There are many ways to scale an image.

The easiest way is to decode the image and then scale using a naive scaling algorithm like:

dest_pixel [x,y] = src_pixel [x * x_scale_factor, y * y_scale_factor]

      



where x / y_scale_factor

src_size / dest_size

      

Once you get started, you can explore more sophisticated scaling systems such as a bilinear filter. For example, a destination pixel is the average of multiple source pixels when downsized and interpolates multiple source pixels when upsized.

+2


a source







All Articles