AFL++实战(七)-测试detection

detection

运动分析和目标跟踪,该项目显示了如何跟踪运动对象。它使用Lukas-Kanade方法在视频流中找到运动并为稀疏特征集计算光流。。项目源码

detection的下载

#安装opencv4.0及以上
#安装cmake3.0以上版本
git clone https://github.com/ndrwk/detection.git

有源码测试

测试代码

#include "Capture.h"
#include 

using namespace std;
using namespace cv;

map<milliseconds, Frame> frames;
vector<map<milliseconds, vector<Point>>> allTracks;
mutex mutex_frames, mutex_tracks;

const int cameraNumber = 0;
const string fileName = R"(/home/drew/ClionProjects/detection/123.avi)";
//const string fileName = R"(/home/drew/ClionProjects/detection/TB.mp4)";


int main(int argc,char** argv)
{

	FILE* f = fopen(argv[1], "r");
	if (f == NULL) {
		cout << "Error: File  is not found." << endl;
		return -1;
	}
	fclose(f);
	Capture capture(string(argv[1]));


	thread capturing(&Capture::find, &capture, ref(frames), ref(mutex_frames), ref(allTracks), ref(mutex_tracks));
	thread display(&Capture::display, &capture, ref(frames), ref(mutex_frames), ref(allTracks), ref(mutex_tracks));

	if (capturing.joinable())
	{
		capturing.join();
	}


	if (display.joinable())
	{
		display.join();
	}


	return 0;
}

配置

对于完整的项目,需要将编译器指定为 afl-clang,然后再进行编译。

export CC=afl-clang
export CXX=afl-clang++
mkdir build
cd build
cmake ../
make -j4

fuzz

正式执行 fuzz 测试的命令如下:

mkdir in
# 在in文件下下创建image语料库,使用jpeg.dict字典
# https://github.com/AFLplusplus/AFLplusplus/tree/stable/dictionaries
afl-fuzz  -x mp4.dict -m none -i in -o out_res ./detection -f

测试结果

AFL++实战(七)-测试detection_第1张图片

注意事项

  1. detection/Capture.cpp:156:24: error: use of undeclared identifier ‘CV_TERMCRIT_ITER’ TermCriteria termcrit(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS, 20, 0.03);

AFL++实战(七)-测试detection_第2张图片
源文件中加入 #include

  1. /detection/Capture.cpp:154:27: error: variable type ‘cv::BackgroundSubtractorMOG2’ is an abstract class BackgroundSubtractorMOG2 backgroundSubtractor(10, 25, false);
    AFL++实战(七)-测试detection_第3张图片 Ptr pMOG2 = createBackgroundSubtractorMOG2 (20, 16, true);

pMOG2->apply(frame, mask, 0.001);

  1. undefined reference to symbol ‘pthread_create@@GLIBC_2.2.5’
    AFL++实战(七)-测试detection_第4张图片
    CMakeLists.txt 中改为SET(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++11 -pthread”)

你可能感兴趣的:(模糊测试)