summaryrefslogtreecommitdiff
path: root/imagealgos.h
diff options
context:
space:
mode:
authorNikita Kostovsky <nikita@kostovsky.me>2025-01-12 11:50:34 +0100
committerNikita Kostovsky <nikita@kostovsky.me>2025-01-12 11:50:34 +0100
commit9dde2ab53c8e2c97647164fce89cf149260fbc8f (patch)
treef428169ce67a93d0532d91883e18892736bb26b4 /imagealgos.h
parent8630381c7e1fa1527026b9c823790dc3f92c6321 (diff)
implement calibration
Diffstat (limited to 'imagealgos.h')
-rw-r--r--imagealgos.h49
1 files changed, 1 insertions, 48 deletions
diff --git a/imagealgos.h b/imagealgos.h
index 12dc8cf..60844b8 100644
--- a/imagealgos.h
+++ b/imagealgos.h
@@ -1,62 +1,15 @@
#pragma once
-#include <array>
-#include <cstddef>
-#include <cstdio>
-
-#include <libcamera/pixel_format.h>
-
#include <QLineF>
#include <QList>
-constexpr size_t img_width = 1280;
-constexpr size_t img_height = 800;
-constexpr uint32_t patternSize = 16;
-
-struct Counters
-{
- uint32_t timestampUs { 0 };
- uint32_t measurementCounter { 0 };
- int32_t encoderPosition { 0 };
-};
-
-struct Image
-{
- int width;
- int height;
- uint16_t data[img_height][img_width];
- uint16_t rotated_cw[img_width][img_height];
- size_t dataSize;
- unsigned int stride;
- libcamera::PixelFormat pixelFormat;
- // float pixels[img_width];
- Counters counters {};
- // unsigned int measurementCounter;
- // uint32_t timestampUs;
- // int32_t encoderPosition;
-};
-
-struct Pixels
-{
- Counters counters {};
- std::array<float, img_width> pixels { 0.f };
-
- Pixels& operator+=(const Pixels& other);
- Pixels& operator/=(const float divider);
-};
-
+#include "pixels.h"
size_t pgm_save(Image *img, FILE *outfile, bool really_save = false);
void unpack_10bit(uint8_t const *src, Image const &image, uint16_t *dest);
void unpack_16bit(uint8_t const *src, Image const &image, uint16_t *dest);
-template <typename T>
-T median3(const T& a, const T& b, const T& c) {
- using namespace std;
- return max(min(a,b), min(max(a,b),c));
-}
-
void rotate(Image & image);
Pixels process_columns(Image & image);