代码拉取完成,页面将自动刷新
#include "devices.h"
#include "highspeed/highspeed.h"
#include <fstream>
#include <string>
using namespace std;
#define OUT_INHIBIT(is, func) \
if (is) \
freopen("/dev/null", "w", stdout); \
func; \
if (is) \
freopen("/dev/tty", "w", stdout);
static bool neat = true;
int main(int argc, char *argv[])
{
int n;
char *buff;
for (int i = 1; i < argc; ++i) {
if ("--verbose" == string(argv[i]))
neat = false;
if ("-v" == string(argv[i]))
neat = false;
}
n = highspeed::getStatus();
cout << "Status : " << highspeed::statuses[n] << endl;
n = highspeed::init();
cout << endl << "Initialization : " << (n ? "failed" : "ok") << endl;
n = highspeed::getStatus();
cout << "Status : " << highspeed::statuses[n] << endl;
const char *path = DEFAULT_OUTPUT_IMAGE;
OUT_INHIBIT(neat, buff = highspeed::takePicture());
cout << "Take picture :" << path << endl;
ofstream out("/tmp/photo.jpg.b64", ios::out);
if (out.is_open()) {
out << buff << endl;
out.close();
}
delete buff;
OUT_INHIBIT(neat, n = highspeed::setColorStyle(2));
cout << "Set style of color : " << (n ? "failed" : "ok") << endl;
path = "/tmp/photo_bw.jpg";
OUT_INHIBIT(neat, buff = highspeed::takePicture(path));
cout << "Take picture : " << path << endl;
delete buff;
OUT_INHIBIT(neat, highspeed::setColorStyle(0));
OUT_INHIBIT(neat, n = highspeed::rotate(3));
cout << "rotate: " << (n ? "failed" : "ok") << endl;
path = "/tmp/photo_rotate.jpg";
OUT_INHIBIT(neat, buff = highspeed::takePicture(path));
cout << "Take picture : " << path << endl;
delete buff;
OUT_INHIBIT(neat, n = highspeed::close());
cout << "Close camera : " << (n ? "failed" : "ok") << endl;
n = highspeed::getStatus();
cout << "Status : " << highspeed::statuses[n] << endl;
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。