官方提供的是cpp的代码
环境:vs,opencv
1.配置opencv
首先在vs中新建个项目,把下载到的tgz文件解压,然后把hpp的放到头文件,cpp文件放到原文件,然后调整项目的属性,引入opencv。
参考https://blog.csdn.net/gu1857035894/article/details/125473159,配置opencv
之后运行回报错,提示没有cv.h和highgui.h、IplImage未定义
就在头文件把引入cv的代码换成如下
#include<opencv/cv.h>
#include<opencv/highgui.h>
#include “opencv2/imgproc.hpp”
参考:
https://blog.csdn.net/y601500359/article/details/100974755
https://blog.csdn.net/emperorjade/article/details/49718985
https://blog.csdn.net/yourijing/article/details/50721756
2.调整代码
首先注意调整地址和修改main中argc的默认值,使其为0:
使用了可能未初始化的本地指针变量“det”、‘l1’,新版cpp要初始化指针,给他们赋值NULL就行
目前我就遇到指针初始化和引入库的问题,如果小伙伴们遇到其他问题,根据错误提示修改就行
编译,执行会得到
参考:
https://blog.csdn.net/qq_32108823/article/details/89216186
3.perl、gnuplot
perl是生产gnuplot能够认识的代码,perl执行的是.pl文件,作者在eval__tool中写好了,注意也要修改一些地址:
#!/usr/bin/perl -w
use strict;
#### VARIABLES TO EDIT ####
# where gnuplot is gnuplot的exe文件绝对路径
my $GNUPLOT = "D:/gnuplot/gnuplot/bin/wgnuplot";
# where the binary is evaluate的exe文件绝对路径
my $evaluateBin = "F:/evaluation/evaluation/evaluate.cpp";
# where the images are fddb图片总路径
my $imDir = "F:/FDDB/originalPics/";
# where the folds are fddb路径信息、真值框信息文档路径
my $fddbDir = "F:/FDDB/FDDB-folds";
# where the detections are 最终生成的ROC图像存放位置
my $detDir = "F:/FDDB/";
###########################
my $detFormat = 0; # 0: rectangle, 1: ellipse 2: pixels
sub makeGNUplotFile
{
my $rocFile = shift;
my $gnuplotFile = shift;
my $title = shift;
my $pngFile = shift;
open(GF, ">$gnuplotFile") or die "Can not open $gnuplotFile for writing\n";
#print GF "$GNUPLOT\n";
print GF "set term png\n";
print GF "set size 1,1\n";
print GF "set output \"$pngFile\"\n";
#print GF "set xtics 500\n";
print GF "set ytics 0.1\n";
print GF "set grid\n";
#print GF "set size ratio -1\n";
print GF "set ylabel \"True positive rate\"\n";
print GF "set xlabel \"False positives\"\n";
#print GF "set xr [0:2000]\n";
print GF "set yr [0:1.0]\n";
print GF "set key right bottom\n";
print GF "plot \"$rocFile\" using 2:1 title \"$title\" with lines lw 2 \n";
close(GF);
}
my $gpFile = "F:/evaluation/evaluation/ContROC.p"; #存放ContROC图绘图信息的.p文件绝对路径(需要自己先生成)
my $gpFile1 = "F:/evaluation/evaluation/DistROC.p"; #存放DistROC图绘图信息的.p文件绝对路径
my $title = "FaceBoxes";
# plot the two ROC curves using GNUplot
makeGNUplotFile("F:/evaluation/evaluation/tempContROC.txt", $gpFile, $title, $detDir."ContROC.png");
makeGNUplotFile("F:/evaluation/evaluation/tempDiscROC.txt", $gpFile1, $title, $detDir."DiscROC.png");
之后执行pl文件就获得了.p文件,吧.p文件拖动到gunplot就可以获得roc曲线了