资源简介

这是一篇C++图像融合的论文的代码,写的挺好的,值得参考。想看论文去搜索同名论文

资源截图

代码片段和文件信息

#include “global.h“

// System
#include 
#include 

// OpenCV
#include “opencv2/core/core.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/highgui/highgui.hpp“

#include “align_fill.h“
#include “segment.h“
#include “select_combine.h“

//#define RUN_MY_MODIFIED_PROGRAM 1

//usage: ./segment depth_data.xml multi_focus.avi

int main(int argc char* argv[])
{
// check input parameters
if(argc != 3)
{
std::cout << “Invalid parameters“ << std::endl;
return -1;
}

// initialize the look up table for visualizing depth map 
    InitializeDepthColorTable();

// load depth map data from *.xml
cv::Mat depth;
cv::FileStorage depth_data(argv[1] cv::FileStorage::READ);
depth_data[“data“] >> depth;
//cv::flip(depth depth 1);
CV_Assert( depth.type() == CV_64FC1 );
depth.convertTo(depth CV_16UC1);

// align depth map with color image
cv::Mat aligned_depth;
AlignDepthWithColor(depth aligned_depth);

// create the depth map segmentation class
const double coc_diameter = 0.019; // diameter of the circle of confusion
const double aperture_value = 4.0;
const double focal_length = 24;
GraphbasedImageSeg* ptr_graph_based_seger = new GraphbasedImageSeg(coc_diameter aperture_value focal_length);

// segment
aligned_depth.convertTo(aligned_depth CV_64F);
cv::Mat dst_color;
int small_thresh = 10; // small components removing
std::vector segmented_regions;
int regions = ptr_graph_based_seger->GraphSegment(aligned_depth small_thresh segmented_regions dst_color);
printf(“Segmented regions: %d\n“ regions);
cv::imwrite(“segmentation_result.jpg“ dst_color);

// construct all_in_focus image
cv::Mat all_in_focus_img;
int ret = ConstructAllInFocusImage(segmented_regions argv[2] all_in_focus_img);
if(-1 == ret)
{
std::cout << “ConstructAllInFocusImage error“ << std::endl;
goto CLEAN_UP;
}
else
{
cv::imwrite(“all_in_focus.jpg“ all_in_focus_img);
}

CLEAN_UP:
delete ptr_graph_based_seger;

return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\
     目录           0  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\.deps\
     文件           8  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\.deps\test.Po
     文件         291  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\Makefile
     目录           0  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\
     文件         891  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\align_fill.h
     文件        1628  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\disjoint.h
     文件         310  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\global.h
     文件        4528  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\segment.h
     文件        1212  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\include\select_combine.h
     文件         149  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\readme.txt
     目录           0  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\
     文件        5476  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\align_fill.cpp
     文件        1066  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\disjoint.cpp
     文件        2112  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\global.cpp
     文件        7344  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\segment.cpp
     文件        2839  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\src\select_combine.cpp
     文件      607320  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\test
     文件        2070  2017-10-29 13:16  Depth_Assisted_Multifocus_Image_Fusion-master\test.cpp

评论

共有 条评论