-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageCaptureController.h
More file actions
60 lines (48 loc) · 1.49 KB
/
ImageCaptureController.h
File metadata and controls
60 lines (48 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* ImageCaptureController.h
* Film Scanner Master PC Control Software by Kyle Mikolajczyk
* kyle@kylem.org
*/
#pragma once
#include <OpenImageIO/imagebuf.h>
// Include files to use the pylon API.
#include <pylon/PylonIncludes.h>
#ifdef PYLON_WIN_BUILD
# include <pylon/PylonGUI.h>
#endif
#include <pylon/BaslerUniversalInstantCamera.h>
#include <string>
#include <thread>
#include <atomic>
#include <condition_variable>
#include "RGBImage.h"
#include "RGBImageQueue.h"
using namespace std;
using namespace Pylon;
class ImageCaptureController
{
public:
enum ImageType { RED, GREEN, BLUE }; // Define the enum for image types
static void initializePylon(); // Static method to initialize Pylon
void initializeCamera();
ImageCaptureController(std::string id);
~ImageCaptureController();
int captureFrame(); // Will get all colors for 1 frame
private:
static bool pylonInitialized; // Static flag to check if Pylon is initialized
// This smart pointer will receive the grab result data.
CGrabResultPtr ptrGrabResult;
CInstantCamera camera;
int lastImageId;
std::string captureId;
RGBImageQueue<RGBImage> imageQueue;
std::thread workerThread;
std::atomic<bool> stopWorker;
std::condition_variable stopCondition;
std::mutex stopMutex;
std::vector<uint16_t> scale12BitTo16Bit(const uint16_t* pImageBuffer, int width, int height);
void processQueue();
OIIO::ImageBuf* captureImageAsBuffer();
void manuallyStepThroughImage();
Pylon::CPylonImageWindow window;
};