|
|
@@ -41,7 +41,6 @@
|
|
|
#include <main.h>
|
|
|
#include <m_loger.h>
|
|
|
#include <QMessageBox>
|
|
|
-#define MAX_FRAME 4
|
|
|
|
|
|
class param;
|
|
|
|
|
|
@@ -276,8 +275,8 @@ Frames::Frames(QObject * parent)
|
|
|
connect(this,&Frames::startGrabbing,
|
|
|
this,&Frames::handleGrab);
|
|
|
|
|
|
- connect(this,&Frames::uvcframeAvailable,
|
|
|
- this,&Frames::parseFrame);
|
|
|
+// connect(this,&Frames::uvcframeAvailable,
|
|
|
+// this,&Frames::parseFrame);
|
|
|
|
|
|
connect(this,&Frames::frameAvailable,
|
|
|
this,&Frames::displayFrame);
|
|
|
@@ -288,8 +287,8 @@ Frames::Frames(QObject * parent)
|
|
|
connect(this,&Frames::signal_photo_saved,
|
|
|
this,&Frames::upload_handle);
|
|
|
|
|
|
- connect(&sender_custom,&SenderCustom::signalToSend,
|
|
|
- this,&Frames::parseFrame);
|
|
|
+ // connect(&sender_custom,&SenderCustom::signalToSend,
|
|
|
+ // this,&Frames::parseFrame);
|
|
|
|
|
|
connect(&sender_custom,&SenderCustom::signalQStr,
|
|
|
this,&Frames::processUvchandle);
|
|
|
@@ -375,72 +374,8 @@ Frames::setCameraSw(bool stat_cam)
|
|
|
if(m_streaming_active&&camera_sta) return; //如果已经是打开状态,退出
|
|
|
static int fd = 0;
|
|
|
if(camera_sta){
|
|
|
- if(param::camera_type.contains("qcamera")){ //QCamera
|
|
|
- m_cam->start();
|
|
|
- m_fps_timer->setRunning(camera_sta);
|
|
|
- m_1s->start();
|
|
|
- }else if(param::camera_type.contains("uvc")){ //libuvc
|
|
|
- #if 1
|
|
|
- if(qtContext.isValid()&&jClass->isValid()){
|
|
|
- jClass->callMethod<void>("SetCamera_State","(Landroid/content/Context;Z)V",qtContext.object(),javaState);
|
|
|
- }
|
|
|
- #else
|
|
|
- fd = checkPermission();
|
|
|
- Logger::instance()->log("checkPermission:" + QString::number(fd));
|
|
|
- if(fd){
|
|
|
- res_uvc = uvc_init(&ctx_, NULL); //必须要加,否则第二次打开会无法取流
|
|
|
- if(res_uvc==UVC_SUCCESS){
|
|
|
- Logger::instance()->log("uvc_init Success!");
|
|
|
- res_uvc = uvc_find_device(
|
|
|
- ctx_, &dev_,
|
|
|
- 0, 0, NULL);
|
|
|
- }else{
|
|
|
- uvc_error_handler(res_uvc);
|
|
|
- }
|
|
|
- // important for Android
|
|
|
- #if 0
|
|
|
- res_uvc = uvc_get_device_with_fd(ctx_,&dev_,0,0,0,fd,0,0);
|
|
|
- qDebug() << "uvc_get_device_with_fd res:" << res_uvc;
|
|
|
- #endif
|
|
|
- // Set libusb option to disable device discovery
|
|
|
- #if 0
|
|
|
- int r = unrooted_usb_description(fd);
|
|
|
- qDebug() << "unrooted_usb_description!" << r;
|
|
|
- #endif
|
|
|
-
|
|
|
- res_uvc = uvc_open(dev_, &devh_);
|
|
|
- if(res_uvc==UVC_SUCCESS){
|
|
|
- Logger::instance()->log("uvc_open Success!");
|
|
|
- checkDeviceCapabilities();
|
|
|
- // 设置相机流格式和帧回调函数
|
|
|
- res_uvc = uvc_get_stream_ctrl_format_size(devh_,&streamCtrl,UVC_FRAME_FORMAT_MJPEG,1920,1080,30); //UVC_FRAME_FORMAT_MJPEG
|
|
|
- /* Print out the result */
|
|
|
- uvc_print_stream_ctrl(&streamCtrl, stderr);
|
|
|
- if(res_uvc==UVC_SUCCESS){
|
|
|
- Logger::instance()->log("uvc_get_stream_ctrl_format_size Success!");
|
|
|
- }else{
|
|
|
- uvc_error_handler(res_uvc);
|
|
|
- }
|
|
|
-
|
|
|
- //启动相机流
|
|
|
- res_uvc = uvc_start_streaming(devh_, &streamCtrl, &frameCallback, this,0);
|
|
|
- if(res_uvc == UVC_SUCCESS){
|
|
|
- m_1s->start();
|
|
|
- m_fps_timer->setRunning(true);
|
|
|
- m_streaming_active = true;
|
|
|
- Logger::instance()->log("UVC streaming started...");
|
|
|
- }
|
|
|
- }else{
|
|
|
- camera_sta = false;
|
|
|
- m_streaming_active = false;
|
|
|
- uvc_error_handler(res_uvc);
|
|
|
- }
|
|
|
- }else{
|
|
|
- camera_sta = false;
|
|
|
- m_streaming_active = false;
|
|
|
- }
|
|
|
- #endif
|
|
|
- }else if(param::camera_type.contains("hikrobot")){
|
|
|
+ if(param::camera_type.contains("hikrobot"))
|
|
|
+ {
|
|
|
int ret = testJNI();
|
|
|
qDebug()<<"testJNI ret:" << ret;
|
|
|
#if 0
|
|
|
@@ -784,8 +719,9 @@ Frames::handleGrab(bool sta_cam){
|
|
|
LOG("图片名称:{}",pic_name.toStdString());
|
|
|
if(m_image.save(pic_name,"jpg",80))
|
|
|
{
|
|
|
+ //图片锐化
|
|
|
+ //m_opencvfunc.CustomSharpening(pic_name);
|
|
|
param::ptlist.append(pic_name);
|
|
|
-
|
|
|
/*z3x7*/
|
|
|
if(z_step==3&&x_step==7){
|
|
|
emit stopGrabbing(false);
|
|
|
@@ -793,7 +729,7 @@ Frames::handleGrab(bool sta_cam){
|
|
|
|
|
|
if(z_step<=2&&x_step==7){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","b80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movX_b,"50"));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -803,11 +739,11 @@ Frames::handleGrab(bool sta_cam){
|
|
|
//emit stopGrabbing(false);
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==6){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_f,"50"));
|
|
|
}
|
|
|
|
|
|
/*z3x5*/
|
|
|
@@ -816,11 +752,11 @@ Frames::handleGrab(bool sta_cam){
|
|
|
//emit stopGrabbing(false);
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==5){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","b80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_b,"50"));
|
|
|
}
|
|
|
|
|
|
/*z3x4*/
|
|
|
@@ -828,11 +764,11 @@ Frames::handleGrab(bool sta_cam){
|
|
|
{
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==4){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_f,"50"));
|
|
|
}
|
|
|
|
|
|
/*z3x3*/
|
|
|
@@ -840,11 +776,11 @@ Frames::handleGrab(bool sta_cam){
|
|
|
{
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==3){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","b80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_b,"50"));
|
|
|
}
|
|
|
/**/
|
|
|
|
|
|
@@ -853,11 +789,11 @@ Frames::handleGrab(bool sta_cam){
|
|
|
{
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==2){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_f,"50"));
|
|
|
}
|
|
|
/**/
|
|
|
|
|
|
@@ -866,12 +802,12 @@ Frames::handleGrab(bool sta_cam){
|
|
|
{
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
|
|
|
if(z_step<=2&&x_step==1){
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","b80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_b,"50"));
|
|
|
}
|
|
|
|
|
|
/*z3x0*/
|
|
|
@@ -879,12 +815,12 @@ Frames::handleGrab(bool sta_cam){
|
|
|
{
|
|
|
x_step++;
|
|
|
z_step = 0;
|
|
|
- emit serial_data(m_json.MotorMove("movx","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movx",movX_f,"50"));
|
|
|
}
|
|
|
if(z_step<=2&&x_step==0)
|
|
|
{
|
|
|
z_step++;
|
|
|
- emit serial_data(m_json.MotorMove("movz","f80","50"));
|
|
|
+ emit serial_data(m_json.MotorMove("movz",movZ_f,"50"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -919,360 +855,6 @@ Frames::handleGrab(bool sta_cam){
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-void
|
|
|
-Frames::parseFrame(const cv::Mat& frame){
|
|
|
- if(!isDecoding()&&m_processThread.isFinished()){
|
|
|
- m_decoding = true;
|
|
|
- // 使用互斥锁保护对帧缓冲区的访问
|
|
|
- m_processThread = QtConcurrent::run([=]() {
|
|
|
- frameMutex.lock();
|
|
|
- if(!frame.empty()){
|
|
|
-#if 1
|
|
|
- //进行色彩转换
|
|
|
- // 将YUV422数据转换为RGB格式
|
|
|
- //cv::cvtColor(frame,m_frame,cv::COLOR_RGB2RGBA);
|
|
|
- const int size_frame = m_frame.total()*m_frame.elemSize(); //字节数
|
|
|
-
|
|
|
- // 创建 QVideoFrame 对象,并设置相关参数
|
|
|
- QVideoFrameFormat frame_format(QSize(m_frame.cols, m_frame.rows),
|
|
|
- QVideoFrameFormat::Format_RGBA8888);
|
|
|
- QVideoFrame f(frame_format);
|
|
|
- if(f.map(QVideoFrame::WriteOnly)){
|
|
|
- // 将共享内存数据复制到 QVideoFrame
|
|
|
- memcpy(f.bits(0), m_frame.data, size_frame);
|
|
|
- f.unmap();
|
|
|
- if(m_videoSink != nullptr){
|
|
|
- m_videoSink->setVideoFrame(f);
|
|
|
- }
|
|
|
- }
|
|
|
- #if 0
|
|
|
- if(m_1s->isActive())
|
|
|
- m_qulityString = m_opencvfunc.brenner(m_frame); //计算对比度
|
|
|
- #endif
|
|
|
-#if 1
|
|
|
- QDateTime currentDateTime = QDateTime::currentDateTime();
|
|
|
- QString currentDateTimeString = currentDateTime.toString("yyyyMMddhhmmss");
|
|
|
- QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
|
|
- QString setup_s;
|
|
|
- if(param::camera_tc==100){ //拍照上传
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
- LOG("Pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(param::camera_type.contains("hikrobot")){
|
|
|
- if(cv::imwrite(param::ptlist.at(0).toStdString(), m_frame)){
|
|
|
- param::camera_tc = 10;
|
|
|
- }else{ //失败
|
|
|
- qDebug() << "Failed to imwrite";
|
|
|
- return;
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(f.isValid()) m_image = f.toImage().convertToFormat(QImage::Format_RGB32);
|
|
|
- //m_image = m_videoSink->videoFrame().toImage().convertToFormat(QImage::Format_RGB32);
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",100)) param::camera_tc = 10;
|
|
|
- }
|
|
|
- }else if(param::camera_tc==1){
|
|
|
- if(f.isValid()) m_image = f.toImage().convertToFormat(QImage::Format_RGB32);
|
|
|
- //m_image = m_videoSink->videoFrame().toImage().convertToFormat(QImage::Format_RGB32);
|
|
|
- param::camera_tc = 0;
|
|
|
- switch(param::stitch_photonum){ //拼接数量
|
|
|
- case 1:
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
- LOG("pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",100)) param::camera_tc = 10;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- /*
|
|
|
- * movx b
|
|
|
- */
|
|
|
- switch(param::ptlist.size()){
|
|
|
- case 0:
|
|
|
- if(stitch_des==0){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
- LOG("pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",100)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if(stitch_des==1){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-2.jpg");
|
|
|
- LOG("pt2 is:{}",param::ptlist.at(1).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(1),"jpg",100)){
|
|
|
- stitch_des = 10;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- /*
|
|
|
- * movx b
|
|
|
- * movx b
|
|
|
- */
|
|
|
- switch(param::ptlist.size()){
|
|
|
- case 0:
|
|
|
- if(stitch_des==0){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
- LOG("pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",100)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if(stitch_des==1){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-2.jpg");;
|
|
|
- LOG("pt2 is:{}",param::ptlist.at(1).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(1),"jpg",100)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 2;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if(stitch_des==2){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-3.jpg");
|
|
|
-
|
|
|
- LOG("pt3 is:{}",param::ptlist.at(2).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(1),"jpg",100)) stitch_des = 10;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- /*
|
|
|
- * movx b
|
|
|
- * movz f
|
|
|
- * movx f
|
|
|
- */
|
|
|
- switch(param::ptlist.size()){
|
|
|
- case 0:
|
|
|
- if(stitch_des==0){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
-
|
|
|
- LOG("pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",100)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if(stitch_des==1){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-2.jpg");
|
|
|
-
|
|
|
- LOG("pt2 is:{}",param::ptlist.at(1).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(1),"jpg",100)){
|
|
|
- //movz f
|
|
|
- setup_s = "f" + QString::number(param::photo_height);
|
|
|
- emit serial_data(m_json.MotorMove("movz",setup_s,""));
|
|
|
- stitch_des = 2;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if(stitch_des==2){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-3.jpg");
|
|
|
-
|
|
|
- LOG("pt3 is:{}",param::ptlist.at(2).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(2),"jpg",100)){
|
|
|
- //movx b
|
|
|
- setup_s = "f" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 3;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- if(stitch_des==3){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-4.jpg");
|
|
|
-
|
|
|
- LOG("pt4 is:{}",param::ptlist.at(3).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(3),"jpg",100)){
|
|
|
- param::camera_tc = 10;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- break;
|
|
|
- case 9:
|
|
|
- /*
|
|
|
- * movx b
|
|
|
- * movx b
|
|
|
- * movz f
|
|
|
- * movx f
|
|
|
- * movx f
|
|
|
- * movz f
|
|
|
- * movx b
|
|
|
- * movx b
|
|
|
- */
|
|
|
- switch(param::ptlist.size()){
|
|
|
- case 0:
|
|
|
- if(stitch_des==0){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-1.jpg");
|
|
|
-
|
|
|
- LOG("pt1 is:{}",param::ptlist.at(0).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(0),"jpg",90)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if(stitch_des==1){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-2.jpg");
|
|
|
- LOG("pt2 is:{}",param::ptlist.at(1).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(1),"jpg",90)){
|
|
|
- //movx b
|
|
|
- setup_s = "b" + QString::number(param::photo_height);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 2;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if(stitch_des==2){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-3.jpg");
|
|
|
-
|
|
|
- LOG("pt3 is:{}",param::ptlist.at(2).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(2),"jpg",90)){
|
|
|
- //movz f
|
|
|
- setup_s = "f" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movz",setup_s,""));
|
|
|
- stitch_des = 3;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case 3: //movx f
|
|
|
- if(stitch_des==3){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-4.jpg");
|
|
|
-
|
|
|
- LOG("pt4 is:{}",param::ptlist.at(3).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(3),"jpg",90)){
|
|
|
- //movx f
|
|
|
- setup_s = "f" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 4;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4: //movx f
|
|
|
- if(stitch_des==4){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-5.jpg");
|
|
|
-
|
|
|
- LOG("pt5 is:{}",param::ptlist.at(4).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(4),"jpg",90)){
|
|
|
- //movx f
|
|
|
- setup_s = "f" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 5;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 5: //movz f
|
|
|
- if(stitch_des==5){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-6.jpg");
|
|
|
-
|
|
|
- LOG("pt6 is:{}",param::ptlist.at(5).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(5),"jpg",90)){
|
|
|
-
|
|
|
- setup_s = "f" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movz",setup_s,""));
|
|
|
- stitch_des = 6;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 6: //movx b
|
|
|
- if(stitch_des==6){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-7.jpg");
|
|
|
-
|
|
|
- LOG("pt7 is:{}",param::ptlist.at(6).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(6),"jpg",90)){
|
|
|
- //movx f
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 7;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 7: //movx b
|
|
|
- if(stitch_des==7){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-8.jpg");
|
|
|
-
|
|
|
- LOG("pt8 is:{}",param::ptlist.at(7).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(7),"jpg",90)){
|
|
|
- //movx f
|
|
|
- setup_s = "b" + QString::number(param::photo_width);
|
|
|
- emit serial_data(m_json.MotorMove("movx",setup_s,""));
|
|
|
- stitch_des = 8;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- if(stitch_des==8){
|
|
|
- param::ptlist.append(appDataPath + "/" + currentDateTimeString + "-9.jpg");
|
|
|
- LOG("pt9 is:{}",param::ptlist.at(8).toStdString());
|
|
|
- if(m_image.save(param::ptlist.at(8),"jpg",90)){
|
|
|
- param::camera_tc = 10;
|
|
|
- stitch_des = 9;
|
|
|
- max_image_qulity = 0.0;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-#endif //拼接
|
|
|
-
|
|
|
-
|
|
|
-#endif //解析
|
|
|
- m_fps_timer->incrementFrame();
|
|
|
- }else{
|
|
|
- qDebug() << "消息队列为空!";
|
|
|
- }
|
|
|
- frameMutex.unlock();
|
|
|
- m_decoding = false;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if(param::camera_tc == 10){
|
|
|
- emit signal_stitch();
|
|
|
- setCameraSw(false);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
void
|
|
|
Frames::registerQmlType()
|
|
|
@@ -1472,17 +1054,12 @@ Frames::saveImage()
|
|
|
emit qulityStringChanged();
|
|
|
LOG("image_gray:{}",grayvalue);
|
|
|
LOG("Tenengrad:{}",m_qulityString.toStdString());
|
|
|
- if(grayvalue<50.0){
|
|
|
+ if(grayvalue<10.0){
|
|
|
emit dataUpload(m_json.MakeJsonWarn("Photo ERROR",QString::number(grayvalue)));
|
|
|
setCameraSw(false); //关闭相机
|
|
|
emit signal_photoerr();
|
|
|
return;
|
|
|
}
|
|
|
- // if(param::ptlist.empty()){
|
|
|
- // emit serial_data(m_json.MotorMove("movy","f20","1"));
|
|
|
- // }else{
|
|
|
- // emit serial_data(m_json.MotorMove("movy","f4","1"));
|
|
|
- // }
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
@@ -1605,16 +1182,6 @@ Frames::displayCameraError(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
-void
|
|
|
-Frames::sendImage(QImage frame){
|
|
|
- m_pImgProvider->updateImage(frame);
|
|
|
- emit callQmlRefeshImg();
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
} /* namespace Qt6QCamera */
|