Qt获取时间戳作为图片名

Qt获取时间戳作为图片名

//保存图片
void SaveRealsenseImg()
{
    QString picIndexName = dataSavePath;
    picIndexName.append("/");

    //获取当前时间
    QDateTime time = QDateTime::currentDateTime();
    //将当前时间转为时间戳
    int timeT = time.toTime_t();
    QString fileName_1 = GetDateTimeStr();
    QString picName = "";
    int checkBoxNumIndex = -1;
    if (checkBoxNum != -1)
    {
        checkBoxNumIndex = checkBoxNum;
        fileName_1.append(QString::number(checkBoxNum));
    }
    picName = fileName_1;
    picName.append(".jpg");

    QString qFilePath = "";
    QString qPicPath1 = picIndexName.append(picName);

    cv::Mat img1920;
    cv::Mat commonImg1 = RotateImg(commonImg);
    cv::resize(commonImg1, img1920, cv::Size(1080, 1920));
    cv::cvtColor(img1920, img1920, CV_BGR2RGB);
    cv::imwrite(qPicPath1.toStdString(), img1920);

}

 

posted @ 2019-09-26 19:54  西北逍遥  阅读(817)  评论(0编辑  收藏  举报