femtoCAM/framebatch.h
2025-12-14 22:11:08 +01:00

55 lines
1.2 KiB
C

#ifndef FRAMEBATCH_H
#define FRAMEBATCH_H
#define BATCHSIZE 100
#define MAX_BATCHES 10
#define N_THREADS 1
#include <opencv4/opencv2/opencv.hpp>
#include <QList>
#include <QMutex>
#include "arv.h"
struct Hit {
uint16_t cx;
uint16_t cy;
uint16_t area;
};
struct ProcessingResult {
cv::Mat composit;
QList<Hit> extended_data;
};
struct ProcessingConfig {
int thresholdValue = 128;
bool adaptive = false;
int adaptiveBlocksize = 11;
int adaptiveShift = 2;
int contourMinSize = 3;
int contourMinArea = 5;
int contourMaxArea = 1000;
bool correctDoubleHits = true;
int numDatapoints = 4;
};
struct alignas(64) FrameBatch {
static constexpr int BatchSize = BATCHSIZE;
ArvBuffer* frames[BatchSize];
quint64 frame_no[BatchSize]; // Possibly optional if constructing takes too long
int count = 0;
};
struct BatchResult {
ProcessingResult result[BATCHSIZE];
quint64 frame_no[BATCHSIZE];
quint64 hit_hist[10] = {};
cv::Mat batch_composit = cv::Mat::zeros(100, 100, CV_8U); // TODO config size!
};
struct ResList {
QList<BatchResult*> results;
QMutex *resultMutex = new QMutex();
};
#endif // FRAMEBATCH_H