forked from embeye/QEmbeddedEye
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqimagesaver.cpp
More file actions
65 lines (59 loc) · 2.03 KB
/
Copy pathqimagesaver.cpp
File metadata and controls
65 lines (59 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "qimagesaver.h"
#include <iostream>
#include <string>
#include <QFile>
#include <QTextStream>
QImageSaver::QImageSaver(int numFramesToSave)
{
mNumFramesToSave = numFramesToSave;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void QImageSaver::setFrameCaptured(cv::Mat *frm)
{
sendStatus("Got a frame!");
mFrmPointer = frm->clone();
}
////////////////////////////////////////////////////////////////////////////////////////////////
void QImageSaver::startSaving()
{
//QString filename="QEM.txt";
//QFile file( filename );
//if ( file.open(QIODevice::ReadWrite) )
//{
// QTextStream stream( &file );
// while(mCurrNumFramesSaved++ < mNumFramesToSave)
// {
// if(mCurrNumFramesSaved%1000==0)
// {
// sendStatus("Currently at:" + QString::number(mCurrNumFramesSaved));
// }
// stream << "something:" + QString::number(mCurrNumFramesSaved) << endl;
// }
//}
//sendStatus("STARTED TO SAVE!");
std::string fileName = "./imgs/img";
std::string fileType = ".jpg";
//mFrmPointer = cv::Mat(400,400,CV_8UC3, cv::Scalar(255,0,100));
while(mCurrNumFramesSaved < mNumFramesToSave)
{
//locker.lock();
//if(mFrmPointer.data)
//{
// // fileName + std::to_string(mCurrNumFramesSaved) + fileType
// if(!cv::imwrite(fileName + std::to_string(mCurrNumFramesSaved) + fileType, mFrmPointer)){
// sendStatus("FAILED TO SAVE!");
// }
// else
// {
// mCurrNumFramesSaved++;sendStatus("Saved Frame:" + QString::number(mCurrNumFramesSaved));
// }
//}
//else
//{
// //sendStatus("No Data to save!");
//}
//locker.unlock();
}
emit finishedSaving();
}
////////////////////////////////////////////////////////////////////////////////////////////////