使用这个patch, 看看是否可以。
diff --git a/examples/camera/main.cpp b/examples/camera/main.cpp
index d485c91..266390f 100644
--- a/examples/camera/main.cpp
+++ b/examples/camera/main.cpp
@@ -31,9 +31,11 @@
using namespace std;
using namespace cv;
-const int max_channel = 8;
+const int max_channel = 4;
const int max_img_count = 16;
+const int rows = 2;
+const int cols = 2;
/**
* create memory pool for images gotten from camera.
*/
@@ -145,12 +147,12 @@ int main(int argc, char **argv) {
getScreenResolution(scrn_width, scrn_height);
//printf("Screen resolution: %dx%d\n", scrn_width, scrn_height);
if (scrn_width < 1920) {
- width = scrn_width / 3;
+ width = scrn_width / rows;
height = width * 480 / 640;
}
if (scrn_height < 1440) {
- height = scrn_height / 3;
+ height = scrn_height / cols;
width = height * 640 / 480;
}
@@ -229,28 +231,28 @@ int main(int argc, char **argv) {
Mat blankimg(height, width, CV_8UC3, Scalar(255, 255, 255));
int row = 0, col = 0;
- Mat showimgs[9];
- Mat extrow[3];
+ Mat showimgs[rows * cols];
+ Mat extrow[rows];
vector < Mat > rowimgs;
//std::cout << "Enter the main loop!" << endl;
while (true) {
rowimgs.clear();
- for (int row = 0; row < 3; row++) {
+ for (int row = 0; row < rows; row++) {
//std::cout << "row = " << row << std::endl;
vector < Mat > colimgs;
- for (int col = 0; col < 3; col++) {
- if (cam_cfg[col + row * 3].isenabled) {
+ for (int col = 0; col < cols; col++) {
+ if (cam_cfg[col + row * rows].isenabled) {
cv::Mat *pimg = nullptr;
//std::cout << "row = " << row << ", col = " << col << std::endl;
- _imgdata[col + row * 3].pop(pimg);
+ _imgdata[col + row * rows].pop(pimg);
if (nullptr == pimg) {
usleep(100);
continue;
}
- showimgs[col + row * 3] = pimg->clone();
- _idleimgbuf[col + row * 3].push(pimg);
- colimgs.push_back(showimgs[col + row * 3]);
+ showimgs[col + row * rows] = pimg->clone();
+ _idleimgbuf[col + row * rows].push(pimg);
+ colimgs.push_back(showimgs[col + row * rows]);
//cv::resize(showimg[i], imgRoi[i], imgRoi[i].size());
} else {
//std::cout << "push blank image" << std::endl;