From 626f08162b07a49e8683bfb04a71ac02faa9b12d Mon Sep 17 00:00:00 2001 From: Nikita Kostovsky Date: Sat, 25 Jan 2025 18:44:39 +0100 Subject: add inno-maker ov9281 stream. cmake config failed --- main.cpp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'main.cpp') 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) { + 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 cm = std::make_unique(); 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; } -- cgit v1.2.3-70-g09d2