Off by one mistake
This commit is contained in:
parent
90dba3f819
commit
605757b791
6 changed files with 13 additions and 14 deletions
|
|
@ -1,4 +1,5 @@
|
|||
QT += core gui charts
|
||||
CONFIG += sanitizer sanitize_address
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ struct BatchResult {
|
|||
ProcessingResult result[BATCHSIZE];
|
||||
quint64 frame_no[BATCHSIZE];
|
||||
quint64 hit_hist[10] = {};
|
||||
cv::Mat batch_composit = cv::Mat::zeros(100, 100, CV_8UC1); // TODO config size!
|
||||
cv::Mat batch_composit = cv::Mat::zeros(100, 100, CV_8U); // TODO config size!
|
||||
};
|
||||
|
||||
struct ResList {
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ void IdsCam::buffer_polling()
|
|||
if(i == batch_results_n-1)
|
||||
{
|
||||
emit new_hist_av(cur->hit_hist);
|
||||
//cv::addWeighted(average_all, 0.5, cur->batch_composit, 0.5, 0, average_all); // WTF is this crashing with errpr "not same type" >>> tomorrow
|
||||
cv::addWeighted(average_all, 0.9, cur->batch_composit, 0.1, 0, average_all);
|
||||
cv::Mat* data_ptr = new cv::Mat(cur->batch_composit.clone());
|
||||
emit new_batch_view(data_ptr); // Cleanup handled by reciever!
|
||||
emit new_avg_view(&average_all);
|
||||
|
|
|
|||
|
|
@ -16,18 +16,14 @@ void Worker::run()
|
|||
batch_result->result[i] = processArvBuffer(batch->frames[i], cfg);
|
||||
batch_result->frame_no[i] = batch->frame_no[i]; // TODO: a lot of optimisation could be done!
|
||||
|
||||
quint8 hits = std::min(batch_result->result[i].extended_data.length(), 10); // Max 10 hits in histogramm
|
||||
quint8 hits = std::min(batch_result->result[i].extended_data.length(), 9); // Max 10 hits in histogramm
|
||||
batch_result->hit_hist[hits]++;
|
||||
|
||||
foreach(Hit hit, batch_result->result[i].extended_data)
|
||||
{
|
||||
int cy = std::min((hit.cy*100) / batch_result->result[i].composit.rows, 100); // TODO config size!
|
||||
int cx = std::min((hit.cx*100) / batch_result->result[i].composit.cols, 100); // TODO config size!
|
||||
try {
|
||||
batch_result->batch_composit.at<uint8_t>(cy, cx) += 255/batch_result->result[i].extended_data.length();
|
||||
} catch (cv::Exception) {
|
||||
qDebug() << "FIXME"; // Why is this also crashing - FIXME!!!
|
||||
}
|
||||
int cy = std::min((hit.cy*100) / batch_result->result[i].composit.rows, 99); // TODO config size!
|
||||
int cx = std::min((hit.cx*100) / batch_result->result[i].composit.cols, 99); // TODO config size!
|
||||
batch_result->batch_composit.at<uchar>(cy, cx) += (uint8_t)(255/batch_result->result[i].extended_data.length());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -69,8 +65,8 @@ ProcessingResult processArvBuffer(ArvBuffer* buffer, const ProcessingConfig& con
|
|||
}
|
||||
|
||||
// --- Wrap raw data in a cv::Mat (no copy) ---
|
||||
Mat frame(height, width, CV_8UC1, (void*)data);
|
||||
result.composit = Mat::zeros(height, width, CV_8UC1);
|
||||
Mat frame(height, width, CV_8U, (void*)data);
|
||||
result.composit = Mat::zeros(height, width, CV_8U);
|
||||
|
||||
// --- Thresholding ---
|
||||
Mat frame_threshold;
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@ void StatsView::vis_new_batch_view(cv::Mat *img)
|
|||
cur_batch_vis = img;
|
||||
|
||||
ui->live_view->setPixmap(QPixmap::fromImage(QImage((uchar*)img->data, img->cols, img->rows, QImage::Format_Grayscale8)));
|
||||
ui->live_view->setText("");
|
||||
}
|
||||
|
||||
void StatsView::vis_new_avg_view(cv::Mat *img)
|
||||
{
|
||||
ui->avg_view->setPixmap(QPixmap::fromImage(QImage((uchar*)img->data, img->cols, img->rows, QImage::Format_Grayscale8)));
|
||||
ui->avg_view->setText("");
|
||||
}
|
||||
|
||||
CountChart::CountChart(QChartView *view)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>NO DATA</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>NO DATA</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue