summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorNikita Kostovsky <nikita@kostovsky.me>2025-01-25 18:44:39 +0100
committerNikita Kostovsky <nikita@kostovsky.me>2025-01-25 18:44:39 +0100
commit626f08162b07a49e8683bfb04a71ac02faa9b12d (patch)
tree8a36066b9d7154b076fff3a9fe0c706a18ad0821 /main.cpp
parent459fe70f53b2f3a7dc33c3833210f60840a23204 (diff)
add inno-maker ov9281 stream. cmake config failed
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/main.cpp b/main.cpp
index 19108d0..e8de499 100644
--- a/main.cpp
+++ b/main.cpp
@@ -17,6 +17,7 @@
#include "httpservice.h"
#include "imagealgos.h"
#include "laser.h"
+#include "macro.h"
#include "pigpio.h"
#include "printerclient.h"
#include "profile.h"
@@ -91,6 +92,7 @@ auto printPixels = [](const auto& pixels) {
void onNewImage(
std::shared_ptr<Image> image)
{
+ std::cout << __func__ << std::endl << std::flush;
if (!image) {
qDebug() << __func__ << "no image";
return;
@@ -126,26 +128,29 @@ int main(int argc, char* argv[])
QCoreApplication app(argc, argv);
#ifdef INNO_MAKER
- {
+ if (false) {
std::cout << std::boolalpha;
InnoMakerOV9281 innoMakerCam;
qDebug() << "init:" << innoMakerCam.init();
qDebug() << "set exposure:" << innoMakerCam.setExposureTimeMs(3000);
qDebug() << "set gain:" << innoMakerCam.setGain(3000);
- Image buf;
+ innoMakerCam.startStream();
+ QThread::sleep(3);
+ qDebug() << "should be stopped";
+ // Image buf;
- for (size_t i = 0; i < 1000; ++i) {
- if (!innoMakerCam.getImage(buf)) {
- break;
- }
+ // for (size_t i = 0; i < 1000; ++i) {
+ // if (!innoMakerCam.getImage(buf)) {
+ // break;
+ // }
- buf.rotate();
- auto pixels = buf.pixels();
- }
+ // buf.rotate();
+ // auto pixels = buf.pixels();
+ // }
}
- qDebug() << "ok";
- exit(EXIT_SUCCESS);
+ // qDebug() << "ok";
+ // exit(EXIT_SUCCESS);
#endif
// if (false)
@@ -336,29 +341,39 @@ int main(int argc, char* argv[])
qDebug() << "msecs before camera:" << t.elapsed();
// FIXME: don't use one var for everything
int ret;
+#ifndef INNO_MAKER
std::unique_ptr<libcamera::CameraManager> cm =
std::make_unique<libcamera::CameraManager>();
cm->start();
-
+#endif
// const auto cameras = cm->cameras();
- const auto cameras = OV9281::search(cm);
+ // const auto cameras = OV9281::search(cm);
+ const auto cameras = InnoMakerOV9281::search();
+ // const auto cameras =
if (cameras.empty()) {
std::cerr << "No cameras were identified on the system." << std::endl;
+#ifndef INNO_MAKER
cm->stop();
+#endif
return EXIT_FAILURE;
}
auto camera = cameras.at(0);
+#ifndef INNO_MAKER
camera->printControls();
+#endif
+ std::cout << "connect everything" << std::endl;
camera->newPixels.connect(&onNewPixels);
camera->newImage.connect(&onNewImage);
if (!camera->startStream()) {
+#ifndef INNO_MAKER
cm->stop();
+#endif
return EXIT_FAILURE;
}
@@ -634,7 +649,9 @@ int main(int argc, char* argv[])
// allocator.reset();
// camera->release();
// camera.reset();
+#ifndef INNO_MAKER
cm->stop();
+#endif
return result;
}