34 #ifndef vpImageStorageWorker_h
35 #define vpImageStorageWorker_h
37 #include <visp3/core/vpConfig.h>
39 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) && defined(VISP_HAVE_THREADS)
41 #include <visp3/io/vpImageIo.h>
42 #include <visp3/io/vpImageQueue.h>
61 : m_queue(queue), m_dataname(
""), m_cpt(1), m_ofs_data(), m_data_file_created(false)
63 m_seqname = queue.getSeqName();
64 m_record_mode = queue.getRecordingMode();
75 char filename[FILENAME_MAX];
81 snprintf(filename, FILENAME_MAX, m_seqname.c_str(), m_cpt);
83 if (m_record_mode > 0) {
84 std::cout <<
"Save image: " << filename << std::endl;
86 else if (m_cpt == 1) {
87 std::cout <<
"Started sequence saving: " << m_seqname << std::endl;
92 if (!m_data_file_created) {
94 if (!parent.empty()) {
100 std::cout <<
"Create data file: " << m_dataname << std::endl;
101 m_ofs_data.open(m_dataname);
103 m_data_file_created =
true;
111 catch (
const vpImageQueue<vpRGBa>::vpCancelled_t &) {
112 std::cout <<
"Receive cancel during color image saving." << std::endl;
113 if (m_data_file_created) {
114 std::cout <<
"Close data file: " << m_dataname << std::endl;
118 catch (
const vpImageQueue<unsigned char>::vpCancelled_t &) {
119 std::cout <<
"Receive cancel during gray image saving." << std::endl;
120 if (m_data_file_created) {
121 std::cout <<
"Close data file: " << m_dataname << std::endl;
128 vpImageQueue<Type> &m_queue;
129 std::string m_seqname;
130 std::string m_dataname;
133 std::ofstream m_ofs_data;
134 bool m_data_file_created;
static void write(const vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
vpImageStorageWorker(vpImageQueue< Type > &queue)
Definition of the vpImage class member functions.