-
大小: 18.14MB文件类型: .gz金币: 1下载: 0 次发布日期: 2023-07-14
- 语言: C/C++
- 标签: segmentation graph-based image
资源简介
Selective Search论文中部分功能的C++实现,eclipse下的C++工程,直接导入即可。具体内容参考相关文论及本人博客。
代码片段和文件信息
/*
* Copyright @ Surge Wong -- 2014/09/05
*/
#include “opencv2/objdetect/objdetect.hpp“
#include “opencv2/features2d/features2d.hpp“
#include “opencv2/highgui/highgui.hpp“
#include “opencv2/calib3d/calib3d.hpp“
#include “opencv2/nonfree/nonfree.hpp“
#include “opencv2/imgproc/imgproc_c.h“
#include “opencv2/legacy/legacy.hpp“
#include “opencv2/legacy/compat.hpp“
#include
#include
#include
#include
#include “FelZenSegment/image.h“
#include “FelZenSegment/misc.h“
#include “FelZenSegment/pnmfile.h“
#include “generate_bounding_boxes.h“
#include “type_convert.h“
using namespace std;
using namespace cv;
int main(int argc char **argv) {
// if(argc < 3){
// fprintf(stderr“Usage:%s inputimage(input) bounding-box(output) sigma k min\n“argv[0]);
// fprintf(stderr“For example:\n%s lena.jpg BB.txt\n“);
// exit(1);
// }
// const char* imagename = argv[1];
// const char* outBB = argv[2];
const char imagename[100] = “4.PPM“;
const char outBB[100] = “BoundingBoxes.txt“;
float sigma = 0.8;
float k = 200;
int min_size = 100;
// read image
Mat img = imread(imagename);
// convert to image type
image* imginput = matToImage(img);
int region_nums;
int* BB = generate_bounding_boxes(imginput sigma k min_size ®ion_nums);
FILE* f;
f = fopen(outBB“w“);
for(int i = 0; i < region_nums;i++){
fprintf(f“%d %d %d %d \n“BB[4*i+0]BB[4*i+1]BB[4*i+2]BB[4*i+3]);
}
fclose(f);
for(int i = 0; i < region_nums; i++){
rgb color = random_rgb();
for(int j = BB[4*i+0]; j <= BB[4*i+2]; j++){
imRef(imginputjBB[4*i+1]) = color;
imRef(imginputjBB[4*i+3]) = color;
}
for(int j = BB[4*i+1]; j <= BB[4*i+3]; j++){
imRef(imginputBB[4*i+0]j) = color;
imRef(imginputBB[4*i+2]j) = color;
}
}
img = *imageToMat(imginput);
imwrite(“testmat.jpg“img);
printf(“That is a hard work..\n“);
delete imginput;
return 0;
}
相关资源
- C++ 解析rtsp流后返回Iplimage,用Opengl显
- ImageEN v8.3.0 fullsource For Xe10.4
- GDAL遥感影像处理
- MFC 实现 图片的拖动 放大缩小和区域
- Matlab实现Mnist-image 手写数字图像识别
- MFC显示图片的相关文件
- 图像分割—基于图的图像分割Graph-b
- CvvImage.zip类文件
- 数字水印源代码,C语言程序
- vc6使用CImage的程序
- MFC必用的CwImage库
- 支持多标签的convert_imageset.cpp代码
- ImageBasicDemo.rar
- CvvImage类库
- linux下可用的静态ImageMagick C库
- C++实战源码-通过Image控件实现动画
- ImageProcessing
- KCF源码的输入图片序列的图片名称i
- QT - Mat - QImage 并在 qml 中显示
- Image2Lcd 2.9(破解版).7z
- C++ CImage类
评论
共有 条评论