gpt4 book ai didi

c++ - 使用其数据调整图像大小

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:58:17 24 4
gpt4 key购买 nike

我有一个 C++ 程序,它读取图像文件,处理文件头,然后将图像的颜色数据存储在指向字符指针的指针中

unsigned char** pixelData = new unsigned char*[header.width*header.height];
for(int i=0;i<header.width*header.height;i++)
pixelData[i] = new unsigned char[bytes2read]; //bytes2read is 3(rgb) or 4(rgba)

如果我想将图像重新缩放到其原始大小的一半,我该怎么做?有谁知道一个方便的算法吗?

最佳答案

使用 OpenGL 怎么样。这对于 OpenGL 来说几乎是微不足道的,最好的部分是该操作是 GPU 加速的。

关于c++ - 使用其数据调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14462299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com