예제 #1
0
void software_3x3_filter(const char *input)
{
    filter_params filter;
    Image iImage = IMAGE_INITIALIZER;
    Image oImage = IMAGE_INITIALIZER;
    Benchmark b;
    int val = 0;

    initBenchmark(&b, "Software 3x3 Filter", "");

    filter_Init(&filter, 4, 2, 1, 4);
    ImageRead(input, &iImage);

    startBenchmark(&b);
    val = filter_Execute(&filter, &iImage, &oImage);
    stopBenchmark(&b);

    if(val != 0) {
        fprintf(stderr, "software_3x3_filter: ERROR: Filter failed.\n");
    }

    printBenchmark(&b);
    ImageWrite("software_3x3.tif",&oImage);
    ImageCleanup(&oImage);
    ImageCleanup(&iImage);
}
예제 #2
0
//IMU初始化
void IMU_Init()
{
	//滤波器参数初始化
	filter_Init();
	//传感器初始化
	Sensor_Init("mpu6050",ORIENT_TOP_0DEG);	
}
예제 #3
0
파일: ANO_IMU.cpp 프로젝트: YuMeiLau/UAV
//IMU初始化
void ANO_IMU::Init()
{
	//滤波器参数初始化
	filter_Init();
	//传感器初始化
	sensor_Init();	
}
예제 #4
0
void software_hardware_exhaustive(const char *input)
{
#ifdef ZYNQ
    const int nRuns = 500;
    int i = 0;
    hardware_config hard_config;
    filter_params filter;
    Image iImage = IMAGE_INITIALIZER;
    Image oImage = IMAGE_INITIALIZER;
    int val = 0;
    volatile int j = 0;
    Benchmark b_software;
    Benchmark b_hardware;

    initBenchmark(&b_software, "Software 3x3 filter", "");
    initBenchmark(&b_hardware, "Hardware 3x3 filter", "");

    ImageRead(input, &iImage);

    filter_Init(&filter, 4, 2, 1, 4);

    val = hardware_filter_init(&iImage, &hard_config);
    fprintf(stdout, "Running hardware %d times\n", nRuns);
    startBenchmark(&b_hardware);
    for(i = 0; i < nRuns; i++) {
        val = hardware_filter_execute(&hard_config);
    }
    stopBenchmark(&b_hardware);
    val = hardware_filter_cleanup(&iImage, &oImage, &hard_config);
    fprintf(stdout, "Hardware runs complete\n");
    fprintf(stdout, "Runnning software %d times\n", nRuns);
    for(i = 0; i < nRuns; i++) {
        val = filter_Execute(&filter, &iImage, &oImage);
    }
    stopBenchmark(&b_software);
    fprintf(stdout, "Software runs complete\n");

    printBenchmarkAvg(&b_hardware,nRuns);
    printBenchmarkAvg(&b_software,nRuns);

#else
    fprintf(stderr, "Hardware exhaustive run not supported on x86 platform\n");
#endif


}
예제 #5
0
void verify_hardware(const char *input)
{
#ifdef ZYNQ
    hardware_config hard_config;
    filter_params filter;
    Image iImage = IMAGE_INITIALIZER;
    Image oImage_software = IMAGE_INITIALIZER;
    Image oImage_hardware = IMAGE_INITIALIZER;
    unsigned char *hImage = NULL;
    unsigned char *sImage = NULL;
    int i = 0;
    int val = 0;
    int r = 0;
    int c = 0;
    int error = 0;

    ImageRead(input, &iImage);

    filter_Init(&filter, 4, 2, 1, 4);
    if(hardware_filter_init(&iImage, &hard_config) != 0) {
        fprintf(stderr, "hardware_3x3_filter: ERROR: Failed to initialize hardware driver\n");
        return;
    }

    val = hardware_filter_execute(&hard_config);
    if(val != 0) {
        fprintf(stderr, "hardwaree_3x3_filter: ERROR: Filter failed.\n");
    }
    val = hardware_filter_cleanup(&iImage, &oImage_hardware, &hard_config);

    val = filter_Execute(&filter, &iImage, &oImage_software);
    if(val != 0) {
        fprintf(stderr, "software_3x3_filter: ERROR: Filter failed.\n");
    }

    hImage = oImage_hardware.data;
    sImage = oImage_software.data;
    for(r = 0; r < oImage_software.height; r++) {
        for(c = 0; c < oImage_software.width; c++, sImage++, hImage++) {
            if((r <= 2) || (r >= oImage_software.height-3)) {
                continue;
            }
            if((c <= 2) || (c >= oImage_software.width-3)) {
                continue;
            }
            if(*(hImage) != *(sImage)) {
                fprintf(stderr, "Mismatch: Row %d, Col %d, %d != %d\n", r, c, *sImage, *hImage);
                error = 1;
            }
        }
    }
    if(!error) {
        fprintf(stdout, "Images verified correct!\n");
    }

    ImageCleanup(&oImage_software);
    ImageCleanup(&oImage_hardware);
    ImageCleanup(&iImage);

#else
    fprintf(stderr, "Hardware verification of 3x3 filter not supported on x86 platform\n");
#endif


}