图像缩放和C / C ++的旋转 [英] Image scaling and rotating in C/C++

查看:333
本文介绍了图像缩放和C / C ++的旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是缩放2D图像阵列的最佳方式?举例来说,假设我有1024×2048字节的图像,每个字节是一个像素。每个像素灰度级从0到255,我想能够通过任意系数缩放这一形象,并得到一个新的形象。所以,如果我用的0.68的比例缩放图片,我应该得到的大小0.68 * 1024 * 0.68 * 2048的新形象。一些像素将被塌缩到彼此。而且,如果我通过倍缩放3.15说,我会得到一个较大的图像与被复制的像素。那么,什么是完成这一任务的最佳方式?

What is the best way to scale a 2D image array? For instance, suppose I have an image of 1024 x 2048 bytes, with each byte being a pixel. Each pixel is a grayscale level from 0 to 255. I would like to be able to scale this image by an arbitrary factor and get a new image. So, if I scale the image by a factor of 0.68, I should get a new image of size 0.68*1024 x 0.68*2048. some pixels will be collapsed onto each other. And, if I scale by a factor of say 3.15, I would get a larger image with pixels being duplicated. So, what's the best way to accomplish this?

接下来,我希望能够通过任意角度旋转图像,在0至360度(0 - 2PI)的范围内。旋转后的图像的裁剪是不是一个问题。什么是做到这一点的最好方法是什么?

Next, I would like to be able to rotate an image by an arbitrary angle, in the range of 0 to 360 degrees (0 - 2Pi). Cropping of the image after rotating isn't an issue. What would be the best way to do this?

推荐答案

有是acommplish没有简单的方式。无论缩放和旋转都没有微不足道的procesis。

There is no "simple" way of acommplish that. Both scaling and rotating are not "trivial" procesis.

谷歌它对于2D影像库。 难懂++ 可以是一个想法divideandconquer.se点,但还有其他。

Google it for a 2d imaging library. Magick++ can be an idea as divideandconquer.se points, but there are others.

这篇关于图像缩放和C / C ++的旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆