-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.cpp
More file actions
74 lines (54 loc) · 1.53 KB
/
Copy pathtest2.cpp
File metadata and controls
74 lines (54 loc) · 1.53 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
#include "cameralibrary.h"
using namespace CameraLibrary;
using namespace std;
using namespace cv;
/// Importing images
void test()
{
}
int main() {
cout << "Main Program Starting" << endl;
CameraLibrary_EnableDevelopment();
CameraManager::X().WaitForInitialization();
Camera *camera = CameraManager::X().GetCamera();
if (!camera) {
cout << "Camera is invalid" << endl;
return 0;
}
cout << "Camera found, Starting loop" << endl;
const int cameraWidth = 2048;
const int cameraHeight = 1088;
camera->SetVideoType(Core::MJPEGMode);
camera->SetAEC(true);
camera->SetAGC(true);
camera->SetTextOverlay(true);
camera->Start();
//Surface Texture(cameraWidth, cameraHeight);
//Bitmap* framebuffer = new Bitmap(cameraWidth, cameraHeight, Texture.PixelSpan() * 4, Bitmap::ThirtyTwoBit, Texture.GetBuffer());
char imageBuffer[cameraWidth * cameraHeight];
//Mat1b imgBuffer(2048, 1088);
Mat img;
//img = imread("Resources/test.png");
//imshow(" hi", img);
while(1)
{
Frame *frame = camera->GetFrame();
if (frame) {
frame->Rasterize(cameraWidth, cameraHeight, cameraWidth, 8, imageBuffer);
img = Mat(cameraHeight, cameraWidth, CV_8UC1, &imageBuffer);
imshow("hi", img);
char key = (char)cv::waitKey(1);
if (key == 27) break;
//cout << imageBuffer[1000] << endl;
frame->Release();
}
}
cout << "Closing down" << endl;
camera->Release();
CameraManager::X().Shutdown();
return 0;
}