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

推荐订阅源

A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
N
News and Events Feed by Topic
C
Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
Scott Helme
Scott Helme
P
Palo Alto Networks Blog
S
Schneier on Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tor Project blog
量子位
G
Google Developers Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
NISL@THU
NISL@THU
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
AWS News Blog
AWS News Blog
爱范儿
爱范儿
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
L
LINUX DO - 最新话题
Security Archives - TechRepublic
Security Archives - TechRepublic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
Cloudbric
Cloudbric
aimingoo的专栏
aimingoo的专栏
L
Lohrmann on Cybersecurity
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hacker News: Ask HN
Hacker News: Ask HN
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
有赞技术团队
有赞技术团队
S
Security @ Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
P
Proofpoint News Feed
V
V2EX
Martin Fowler
Martin Fowler
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Cloudflare Blog
SecWiki News
SecWiki News
罗磊的独立博客
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
小众软件
小众软件
The Last Watchdog
The Last Watchdog

博客园 - 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);
}