测试 focus stacking

https://github.com/PetteriAimonen/focus-stack
https://github.com/Biomedical-Imaging-Group/EDF-Extended-Depth-of-Field

Helicon Focus 软件 3d重建效果

focus-stack 输出的融合图像

focus-stack 输出的3d渲染图像

仅修改Task_FocusMeasure 后的3d渲染图像

soebel 改laplacian

cpp 复制代码
void Task_FocusMeasure::task()
{
    // Algorithm is based on Tenengrad focus measure from
    // 'Autofocusing Algorithm Selection in Computer Microscopy' by Sun et Al.

    const cv::Mat &input = m_input->img();
    int rows = input.rows;
    int cols = input.cols;
    m_valid_area = m_input->valid_area();

    // Calculate squared gradient magnitude by calculating
    // horizontal and vertical Sobel operator.
    cv::Mat sobel(rows, cols, CV_32F);
    cv::Mat magnitude(rows, cols, CV_32F, cv::Scalar(0));
    cv::Sobel(input, sobel, CV_32FC1, 1, 0);
    cv::accumulateSquare(sobel, magnitude);
    cv::Sobel(input, sobel, CV_32FC1, 0, 1);
    cv::accumulateSquare(sobel, magnitude);
    sobel.release();

    
    //cv::Mat laplacian;
    //cv::Laplacian(input, laplacian, CV_32F);
    //cv::Mat magnitude(rows, cols, CV_32F, cv::Scalar(0));
    //cv::multiply(laplacian, laplacian, magnitude); // squared Laplacian = variance proxy
    //cv::Mat temp;
    //cv::GaussianBlur(magnitude, temp, cv::Size(), 1, 1, cv::BORDER_REFLECT);
   
    ////cv::bilateralFilter(magnitude, temp, 5, 500, 5);
    //cv::medianBlur(temp, temp, 3);
    //magnitude = std::move(temp); 
    m_input.reset();

    magnitude.setTo(0, magnitude < m_threshold);

    if (m_radius > 0)
    {
        int blurwindow = (int)(m_radius * 4) + 1;
        cv::GaussianBlur(magnitude, magnitude, cv::Size(blurwindow, blurwindow), m_radius, m_radius, cv::BORDER_REFLECT);
    }

    cv::sqrt(magnitude, m_result);
}
相关推荐
Flynt4 小时前
这个日增 1400 星的 E2E 框架说"第二次跑不调模型",我改了按钮文案试了试
agent·ai编程·测试
这张生成的图像能检测吗6 小时前
(论文速读)FE-CLIP:把频域信息注入 CLIP,做零样本异常检测与分割
人工智能·opencv·目标检测·计算机视觉·缺陷检测·异常检测
长安米粒贵7 小时前
单元测试写了不少,为什么线上还是没信心?聊聊测试分层的 4 个误区
测试
richard_yuu9 小时前
OpenCV 实战第 5 篇:threshold 全家族 + Otsu + 自适应阈值,参数怎么定
人工智能·opencv
黑妹天下第一乖9 小时前
第 10 讲:阿加犀 AidVoice 端侧语音交互与语音识别实战
图像处理·人工智能·数码相机·opencv·交互·语音识别·xcode
A1Book1 天前
# 从 0 部署 Qwen3.8-27B:量化档位怎么选,终端配置怎么配
llm·测试
匠测AI说1 天前
AI for Testing 提效实战·测试设计(三):让 AI 用场景法串起业务链路,多条件岔路口用判定表一次理清
人工智能·测试
黑妹天下第一乖1 天前
第 05 讲:阿加犀 AidCV 图像处理加速与 OpenCV 一致开发实战
开发语言·图像处理·人工智能·嵌入式硬件·数码相机·opencv·计算机视觉
Zelman2 天前
测试过程模型与左移右移
测试·自动化运维·devops
落梦纷飞2 天前
Playwright 裸写、Cypress、商业录制回放、本地 E2E 工具:四条路线的形状与代价
e2e·测试