惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyberwarzone
Cyberwarzone
F
Full Disclosure
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
J
Java Code Geeks
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
L
LINUX DO - 最新话题
T
Threatpost
S
SegmentFault 最新的问题
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
C
Cyber Attacks, Cyber Crime and Cyber Security
Google DeepMind News
Google DeepMind News
Know Your Adversary
Know Your Adversary
S
Schneier on Security
V
Vulnerabilities – Threatpost
D
DataBreaches.Net
G
GRAHAM CLULEY
Latest news
Latest news
P
Privacy International News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
G
Google Developers Blog
L
LangChain Blog
MyScale Blog
MyScale Blog
Project Zero
Project Zero
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
N
News | PayPal Newsroom
www.infosecurity-magazine.com
www.infosecurity-magazine.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
SecWiki News
SecWiki News
T
Tor Project blog
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
GbyAI
GbyAI
The Last Watchdog
The Last Watchdog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学

博客园 - zhaocundang

MLX90640迷你热像仪管道测温电路维修酒店巡检科研实验数据采集 树莓派4b 安装ubuntu18.04 server glibc2.27 打包分发qt软件 树莓派4b qt打包软件 树莓派4b ubuntu24.04安装qt配置软件源 海曼HTPA80X64红外热成像 测温采集记录仪 多点实时温度分析 海曼HTPA32X32红外热成像 测温采集记录仪 多点实时温度分析 在Ubuntu上的QT创建工程并打包项目 MLX90640热像仪测温采集 科研实验 非接触测温 FLIR LEPTON3.5 热像仪wifi 科研实验测温采集仪 STM32H750 DMA 串口2 D CACHE缓存问题 热像仪报警器MLX90640 qt RGB565 转rgb Qt MacOS 打包dmg MLX90640 热成像 热像仪 OV2640 双光融合 seafile配置 安装基于Ubuntu20.04 Desktop的Raid1。 lvgl qt RGB 转RGB565 生成提供单片机LCD显示 STM32F411CE VCAP 电容不稳定导致死机
qt c语言双三次线性插值
zhaocundang · 2024-01-05 · via 博客园 - zhaocundang

用chatgpt 生成的 测试了比较卡

   for (int y = 0; y < enlargedHeight; y++) {
                    for (int x = 0; x < enlargedWidth; x++) {
                        // 计算原始图像中对应的浮点坐标
                        float originalX = (float)x / (float)enlargedWidth * (float)originalWidth;
                        float originalY = (float)y / (float)enlargedHeight * (float)originalHeight;

                        // 进行双三次线性插值计算
                        QRgb interpolatedPixel = bicubicInterpolation(*img1, originalX, originalY);

                        // 将计算得到的像素值赋给新图像
                        newImg->setPixel(x, y, interpolatedPixel);
                    }
                }
// 原始图像大小
const int originalWidth = 32;
const int originalHeight = 24;

// 放大后的图像大小
const int enlargedWidth = 640;
const int enlargedHeight = 480;


// 双三次线性插值函数
QRgb bicubicInterpolation(const QImage& image, float x, float y) {
    // 计算四个最近的像素点的坐标
    int x1 = qFloor(x);
    int y1 = qFloor(y);
    int x2 = x1 + 1;
    int y2 = y1 + 1;

    // 计算插值权重
    float dx = x - x1;
    float dy = y - y1;

    // 获取四个最近的像素点的颜色值
    QRgb p11 = image.pixel(x1, y1);
    QRgb p12 = image.pixel(x1, y2);
    QRgb p21 = image.pixel(x2, y1);
    QRgb p22 = image.pixel(x2, y2);

    // 对四个像素点进行双三次线性插值计算
    float r = qRed(p11) * (1 - dx) * (1 - dy) + qRed(p21) * dx * (1 - dy) + qRed(p12) * (1 - dx) * dy + qRed(p22) * dx * dy;
    float g = qGreen(p11) * (1 - dx) * (1 - dy) + qGreen(p21) * dx * (1 - dy) + qGreen(p12) * (1 - dx) * dy + qGreen(p22) * dx * dy;
    float b = qBlue(p11) * (1 - dx) * (1 - dy) + qBlue(p21) * dx * (1 - dy) + qBlue(p12) * (1 - dx) * dy + qBlue(p22) * dx * dy;

    return qRgb(r, g, b);
}