根据时间戳保存图片 20191018

根据时间戳保存图片 

//保存人脸图片并 返回图片名
QString c_thread::CameraThread::saveObjFacePicAndReturnFilePath()
{
    QString picFileDir1 = QCoreApplication::applicationDirPath();
    QDateTime qdt1 = QDateTime::currentDateTime();
    QString timeStr = qdt1.toString("yyyyMMddhhmmsszzz");
    QString picStr = timeStr.append(".jpg");

    //qDebug() << picStr;
    picFileDir1.append("/face_data/");
    picFileDir1.append(picStr).replace("/","//");;
    qDebug() << picFileDir1;

    if (photograph2_img.empty())
    {
        qDebug() << "请打开摄像头";
        return "";
    }
    else
    {
        qDebug() << "save pic";
        cv::resize(photograph2_img, photograph2_img, cv::Size(100, 100));
        cv::imwrite(picFileDir1.toStdString(), photograph2_img);
    }
    return picFileDir1;
}

//在QLabel中显示图片
void c_thread::CameraThread::showPhotographOnLabel(QLabel *qLabelParam1)
{
    if (face_img.empty())
    {
        return;
    }

    photograpg_img = face_img.clone();
    photograph2_img = face_img.clone();
    qm_img::DisplayImg(photograpg_img, qLabelParam1);
}
相关文章
相关标签/搜索