version 1.6
-compatible to VITIS_HLS -compatible to ubuntu24.04 -change test data directory
This commit is contained in:
parent
34db2009da
commit
dec5589bdb
@ -6,8 +6,10 @@ void calib(
|
||||
hls::stream<RgnSubPixCalib> &outSubpixCalib
|
||||
)
|
||||
{
|
||||
#if !(VITIS_HLS)
|
||||
#pragma HLS DATA_PACK variable=inCalibData
|
||||
#pragma HLS DATA_PACK variable=outSubpixCalib
|
||||
#endif
|
||||
#pragma HLS INTERFACE axis register both port=inCalibData
|
||||
#pragma HLS INTERFACE axis register both port=outSubpixCalib
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef COMPUTE_3D_H
|
||||
#define COMPUTE_3D_H
|
||||
|
||||
#include "..\..\globals\algoGlobals.h"
|
||||
#include "../../globals/algoGlobals.h"
|
||||
|
||||
void calib(
|
||||
hls::stream<CalibData> &inCalibData,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "ap_utils.h"
|
||||
#include <iostream>
|
||||
#include "calib.h"
|
||||
#include "..\..\globals\tbGlobals.h"
|
||||
#include "../../globals/tbGlobals.h"
|
||||
|
||||
std::vector<RgnSubPix> readSubpixDataFile(
|
||||
const char* file,
|
||||
@ -25,7 +25,11 @@ std::vector<RgnSubPix> readSubpixDataFile(
|
||||
|
||||
float x;
|
||||
int y, Rid, Flag, pkValue;
|
||||
#if defined(__linux__)
|
||||
sscanf(strLineTxt.c_str(), "%f %d %d %x %d", &x, &y, &Rid, &Flag, &pkValue);
|
||||
#else
|
||||
sscanf_s(strLineTxt.c_str(), "%f %d %d %x %d", &x, &y, &Rid, &Flag, &pkValue);
|
||||
#endif
|
||||
|
||||
a_line.x = (float)x;
|
||||
a_line.y = (ap_uint<12>)y;
|
||||
@ -239,8 +243,13 @@ void writeSubpixCalibData(
|
||||
for (int i = 0; i < i_max; i++)
|
||||
{
|
||||
char data[250];
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%.2f %.2f %04d %01x %02d",
|
||||
outData[i].x, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#else
|
||||
sprintf_s(data, "%.2f %.2f %04d %01x %02d",
|
||||
outData[i].x, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
}
|
||||
sw.close();
|
||||
@ -250,12 +259,21 @@ void writeSubpixCalibData(
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Subpix\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Subpix/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Calib\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Calib/testData.txt"
|
||||
};
|
||||
#else
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Subpix/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Calib/testData.txt"
|
||||
};
|
||||
#endif
|
||||
|
||||
for(int n = 0; n < TST_GROUP; n ++)
|
||||
{
|
||||
@ -292,5 +310,5 @@ int main()
|
||||
|
||||
writeSubpixCalibData(OutDataPath[n], outData);
|
||||
}
|
||||
|
||||
printf("done!\n");
|
||||
}
|
||||
|
||||
@ -12,8 +12,10 @@ void compute3D(
|
||||
float plane_c_f
|
||||
)
|
||||
{
|
||||
#if !(VITIS_HLS)
|
||||
#pragma HLS DATA_PACK variable=inSubCalib
|
||||
#pragma HLS DATA_PACK variable=outPt3D
|
||||
#endif
|
||||
#pragma HLS INTERFACE axis register both port=inSubCalib
|
||||
#pragma HLS INTERFACE axis register both port=outPt3D
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef COMPUTE_3D_H
|
||||
#define COMPUTE_3D_H
|
||||
|
||||
#include "..\..\globals\algoGlobals.h"
|
||||
#include "../../globals/algoGlobals.h"
|
||||
|
||||
void compute3D(
|
||||
hls::stream<RgnSubPixCalib> &inSubCalib,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "ap_utils.h"
|
||||
#include <iostream>
|
||||
#include "compute3D.h"
|
||||
#include "..\..\globals\tbGlobals.h"
|
||||
#include "../../globals/tbGlobals.h"
|
||||
|
||||
std::vector<RgnSubPixCalib> readSubpixCalibDataFile(
|
||||
const char* file)
|
||||
@ -22,8 +22,11 @@ std::vector<RgnSubPixCalib> readSubpixCalibDataFile(
|
||||
|
||||
float x,y;
|
||||
int Rid, Flag, pkValue;
|
||||
#if defined(__linux__)
|
||||
sscanf(strLineTxt.c_str(), "%f %f %d %x %d", &x, &y, &Rid, &Flag, &pkValue);
|
||||
#else
|
||||
sscanf_s(strLineTxt.c_str(), "%f %f %d %x %d", &x, &y, &Rid, &Flag, &pkValue);
|
||||
|
||||
#endif
|
||||
a_line.x = (float)x;
|
||||
a_line.y = (float)y;
|
||||
a_line.rid = (ap_uint<11>)Rid;
|
||||
@ -179,8 +182,13 @@ void writeCompute3DData(
|
||||
{
|
||||
char data[250];
|
||||
uint8_t value = (uint8_t)outData[i].value;
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%.3f %.3f %.3f %02d",
|
||||
outData[i].x, outData[i].y, outData[i].z, value);
|
||||
#else
|
||||
sprintf_s(data, "%.3f %.3f %.3f %02d",
|
||||
outData[i].x, outData[i].y, outData[i].z, value);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
}
|
||||
sw.close();
|
||||
@ -190,12 +198,21 @@ void writeCompute3DData(
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Calib\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Calib/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Compute3D\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Compute3D/testData.txt"
|
||||
};
|
||||
#else
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Calib/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Compute3D/testData.txt"
|
||||
};
|
||||
#endif
|
||||
|
||||
for(int n = 0; n < TST_GROUP; n ++)
|
||||
{
|
||||
@ -236,5 +253,5 @@ int main()
|
||||
&outROI_y);
|
||||
writeCompute3DData(OutDataPath[n], outData);
|
||||
}
|
||||
|
||||
printf("done!\n");
|
||||
}
|
||||
|
||||
@ -5,8 +5,10 @@ void convolve(
|
||||
hls::stream<RgnPix> &InRgnPnt,
|
||||
hls::stream<RgnPixConvolve> &OutConvolvePnt)
|
||||
{
|
||||
#if !(VITIS_HLS)
|
||||
#pragma HLS DATA_PACK variable=InRgnPnt
|
||||
#pragma HLS DATA_PACK variable=OutConvolvePnt
|
||||
#endif
|
||||
#pragma HLS INTERFACE axis register both port=OutConvolvePnt
|
||||
#pragma HLS INTERFACE axis register both port=InRgnPnt
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef CONVOLVE_H
|
||||
#define CONVOLVE_H
|
||||
|
||||
#include "..\..\globals\algoGlobals.h"
|
||||
#include "../../globals/algoGlobals.h"
|
||||
|
||||
const int mask_1st[16] =
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "ap_utils.h"
|
||||
#include <iostream>
|
||||
#include "convolve.h"
|
||||
#include "..\..\globals\tbGlobals.h"
|
||||
#include "../../globals/tbGlobals.h"
|
||||
|
||||
std::vector<Luma_rgnData> readTestFile(
|
||||
const char* file,
|
||||
@ -214,12 +214,25 @@ void writeConvolveData(
|
||||
for (int i = 0; i < i_max; i++)
|
||||
{
|
||||
char data[250];
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%04x %04x %04x %01x %02x",
|
||||
outData[i].WinRdx, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#else
|
||||
sprintf_s(data, "%04x %04x %04x %01x %02x",
|
||||
outData[i].WinRdx, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%d",outData[i].nD1);
|
||||
#else
|
||||
sprintf_s(data, "%d",outData[i].nD1);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%d",outData[i].nD2);
|
||||
#else
|
||||
sprintf_s(data, "%d",outData[i].nD2);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
}
|
||||
sw.close();
|
||||
@ -229,13 +242,21 @@ void writeConvolveData(
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\PkCentering\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/PkCentering/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Convolve\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Convolve/testData.txt"
|
||||
};
|
||||
|
||||
#else
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/PkCentering/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Convolve/testData.txt"
|
||||
};
|
||||
#endif
|
||||
for(int n = 0; n < TST_GROUP; n ++)
|
||||
{
|
||||
int winSize = 0;
|
||||
@ -270,5 +291,5 @@ int main()
|
||||
|
||||
writeConvolveData(OutDataPath[n], outData);
|
||||
}
|
||||
|
||||
printf("done!\n");
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
#include "ap_int.h"
|
||||
#include "hls_stream.h"
|
||||
|
||||
#define VITIS_HLS 0
|
||||
|
||||
#define RGN_DATA_WIN_SIZE 16
|
||||
#define RGN_DATA_PIXEL_WIDTH 2 //output 2 pixels per clock
|
||||
#define MAX_PT_NUM 4096
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef TB_GLOBALS_H
|
||||
#define TB_GLOBALS_H
|
||||
|
||||
#include "..\globals\algoGlobals.h"
|
||||
#include "../globals/algoGlobals.h"
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
@ -6,8 +6,10 @@ void peakCentering(
|
||||
hls::stream<RgnPix> &OutCenteringPnt
|
||||
)
|
||||
{
|
||||
#if !(VITIS_HLS)
|
||||
#pragma HLS DATA_PACK variable=OutCenteringPnt
|
||||
#pragma HLS DATA_PACK variable=InRgnPnt
|
||||
#endif
|
||||
#pragma HLS INTERFACE axis register both port=OutCenteringPnt
|
||||
#pragma HLS INTERFACE axis register both port=InRgnPnt
|
||||
|
||||
@ -55,9 +57,18 @@ void peakCentering(
|
||||
RgnPix HSyncData_d1 = {0,0,0,0,0,0,0};
|
||||
ap_uint<12> LazerWinX_d1 = 0;
|
||||
ap_uint<8> lineBuff_0[RGN_DATA_WIN_SIZE * 2];
|
||||
#if VITIS_HLS
|
||||
#pragma HLS BIND_STORAGE variable=lineBuff_0 type=RAM_2p
|
||||
#else
|
||||
//#pragma HLS RESOURCE variable=lineBuff_0 core=RAM_2P
|
||||
#endif
|
||||
|
||||
ap_uint<8> lineBuff_1[RGN_DATA_WIN_SIZE * 2];
|
||||
#if VITIS_HLS
|
||||
#pragma HLS BIND_STORAGE variable=lineBuff_0 type=RAM_2p
|
||||
#else
|
||||
//#pragma HLS RESOURCE variable=lineBuff_1 core=RAM_2P
|
||||
#endif
|
||||
|
||||
//initialize buffer
|
||||
for(int m = 0; m < RGN_DATA_WIN_SIZE * 2; m ++)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef PEAK_CENTERING_H
|
||||
#define PEAK_CENTERING_H
|
||||
|
||||
#include "..\..\globals\algoGlobals.h"
|
||||
#include "../../globals/algoGlobals.h"
|
||||
|
||||
void peakCentering(
|
||||
hls::stream<RgnPix> &InRgnPnt,
|
||||
|
||||
@ -5,14 +5,18 @@
|
||||
#include "ap_utils.h"
|
||||
#include <iostream>
|
||||
#include "peakCentering.h"
|
||||
#include "..\..\globals\tbGlobals.h"
|
||||
#include "../../globals/tbGlobals.h"
|
||||
|
||||
void save_bmp_2(
|
||||
const char* filename,
|
||||
std::vector<Luma_rgnData>& testSamples)
|
||||
{
|
||||
FILE* file;
|
||||
#if defined(__linux__)
|
||||
file = fopen(filename, "wb");
|
||||
#else
|
||||
fopen_s(&file, filename, "wb");
|
||||
#endif
|
||||
if (!file) {
|
||||
printf("ÎÞ·¨´ò¿ªÎļþ %s\n", filename);
|
||||
return;
|
||||
@ -282,18 +286,31 @@ void writepeakCenteringData(
|
||||
{
|
||||
std::ofstream sw(fileName);
|
||||
char str[250];
|
||||
#if defined(__linux__)
|
||||
sprintf(str, "0x10");
|
||||
#else
|
||||
sprintf_s(str, "0x10");
|
||||
#endif
|
||||
sw << str << std::endl;
|
||||
int i_max = outData.size();
|
||||
for (int i = 0; i < i_max; i++)
|
||||
{
|
||||
char data[250];
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%04x %04x %04x %01x %02x",
|
||||
outData[i].WinRdx, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].PeakRltvRdx);
|
||||
#else
|
||||
sprintf_s(data, "%04x %04x %04x %01x %02x",
|
||||
outData[i].WinRdx, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].PeakRltvRdx);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
for (int j = 0; j < RGN_DATA_WIN_SIZE; j++)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%02x", outData[i].data[j]);
|
||||
#else
|
||||
sprintf_s(data, "%02x", outData[i].data[j]);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
}
|
||||
}
|
||||
@ -306,12 +323,21 @@ void writepeakCenteringData(
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\RgnPixData\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/RgnPixData/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\PkCentering\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/PkCentering/testData.txt"
|
||||
};
|
||||
#else
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/RgnPixData/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/PkCentering/testData.txt"
|
||||
};
|
||||
#endif
|
||||
|
||||
for(int n = 0; n < TST_GROUP; n ++)
|
||||
{
|
||||
@ -347,5 +373,6 @@ int main()
|
||||
|
||||
writepeakCenteringData(OutDataPath[n], outData);
|
||||
}
|
||||
printf("done!\n");
|
||||
|
||||
}
|
||||
|
||||
@ -6,8 +6,10 @@ void subpix(
|
||||
hls::stream<RgnSubPix> &OutSubpixPnt
|
||||
)
|
||||
{
|
||||
#if !(VITIS_HLS)
|
||||
#pragma HLS DATA_PACK variable=InConvolvePnt
|
||||
#pragma HLS DATA_PACK variable=OutSubpixPnt
|
||||
#endif
|
||||
#pragma HLS INTERFACE axis register both port=OutSubpixPnt
|
||||
#pragma HLS INTERFACE axis register both port=InConvolvePnt
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#ifndef SUBPIX_H
|
||||
#define SUBPIX_H
|
||||
|
||||
#include "..\..\globals\algoGlobals.h"
|
||||
#include "../../globals/algoGlobals.h"
|
||||
|
||||
void subpix(
|
||||
hls::stream<RgnPixConvolve> &InConvolvePnt,
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "ap_utils.h"
|
||||
#include <iostream>
|
||||
#include "subPix.h"
|
||||
#include "..\..\globals\tbGlobals.h"
|
||||
#include "../../globals/tbGlobals.h"
|
||||
|
||||
std::vector<Luma_convolveData> readConvolveDataFile(
|
||||
const char* file){
|
||||
@ -196,8 +196,13 @@ void writeSubpixData(
|
||||
for (int i = 0; i < i_max; i++)
|
||||
{
|
||||
char data[250];
|
||||
#if defined(__linux__)
|
||||
sprintf(data, "%.2f %04d %04d %01x %02d",
|
||||
outData[i].x, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#else
|
||||
sprintf_s(data, "%.2f %04d %04d %01x %02d",
|
||||
outData[i].x, outData[i].y, outData[i].Rid, outData[i].Flag, outData[i].pkValue);
|
||||
#endif
|
||||
sw << data << std::endl;
|
||||
}
|
||||
sw.close();
|
||||
@ -207,12 +212,21 @@ void writeSubpixData(
|
||||
|
||||
int main()
|
||||
{
|
||||
#if defined(__linux__)
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Convolve\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Convolve/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:\\CamTestData\\Subpix\\testSample\\testData.txt"
|
||||
"/home/zengHQ/CamTestData/testSample/Subpix/testData.txt"
|
||||
};
|
||||
#else
|
||||
const char* InDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Convolve/testData.txt"
|
||||
};
|
||||
const char* OutDataPath[TST_GROUP] = {
|
||||
"E:/CamTestData/testSample/Subpix/testData.txt"
|
||||
};
|
||||
#endif
|
||||
|
||||
for(int n = 0; n < TST_GROUP; n ++)
|
||||
{
|
||||
@ -248,5 +262,6 @@ int main()
|
||||
|
||||
writeSubpixData(OutDataPath[n], outData);
|
||||
}
|
||||
printf("done!\n");
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user