volcamcore  2019 march
Biblioteca volcamcore
Clases
Referencia del Archivo volcamquery.h

Clase para poder interactuar con la base de datos o estructura de archivos de las cámaras de vigilancia usadas por VolCAM (2019) Más...

#include <QObject>
#include <QDebug>
#include "conf_volcam.h"
#include "configuracion.h"
#include "conf_stndevices.h"
#include "conf_tags.h"
#include "conf_pointsofinterest.h"
#include "conf_users.h"
#include "imagenes_wc.h"
#include "measure2d_imagenes_wc.h"
#include "tagged_imagenes_wc.h"

Ir al código fuente de este archivo.

Clases

class  VolcamQuery
 

Descripción detallada

Clase para poder interactuar con la base de datos o estructura de archivos de las cámaras de vigilancia usadas por VolCAM (2019)

Versión
1.0
Fecha
2019 march
Autor
Carlos Alberto Ospina Caicedo (SGC-OVSPo)

Para aprender a usar esta clase puedes ejecutar la función getHelp()

VOLCAM QUERY

Help to use volcamquery.h

This class is a very useful tool to interact with database or file structure data of webcam images (or IP cameras)

It try to use little similar coding as SQL queries like SELECT, INSERT or DELETE

The first thing you have to do is get all the configuration information:

load_config You can get the complete configuration: based on a local file like ./Local_Config_files/VolCAM_popayan.conf

from which you could acces to Tags.txt, Stations.txt, PointsOfInterest.txt, DevicesLogbook.txt, DeviceParameters.txt at sharedDir_VolCAM: ../Shared_Config_files/

and also Users information at sharedDir_VolCAM: ../Users/Users.txt

Probably the second thing you have to do is get all the images and its info from one date to another; to do so, you can use:

select_imgwc_fromall You can get the complete stored info about images in a period of time and filter it by some *items.

Then you will want to insert or delete some tags or measures:

insert_taggedimgwc You can insert a tag or list of tags to a list of imgwc (exactly at the one which has the same datetime and station name) and save it, please if you want to modify a tag, first delete it and then insert it

delete_taggedimgwc You can delete a tag or list of tags

insert_measureimgwc You can insert a measure2d or list of measure2d, please if you want to modify a measure2d, first delete it and then insert it

delete_measureimgwc You can delete a measure2d or list of measure2d

*items To filter by items you can create a text list splited by ';' like:"

"" 2018-12-31T10:20 ; Purace ; measured2D_imgwc " to filter the image list you will get

**saveFormat You could use save format to set in which format you have the data: Json, Binary, Text(csv formatted)

Example of Initializing a VolcamQuery

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");

Example of getting DeviceParameters (dp), DevicesLogBook (dlb), Tags (tags), Points of interest (pointsi) and Users list (usrs)

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");
dp = vquery->dp;
ui->textEdit->append(vquery->conf_stndv->getDevicesLogbook_text(vquery->dlb,"all"));
ui->textEdit->append(vquery->conf_tags->getTags_text(vquery->tags,"all"));
ui->textEdit->append(vquery->conf_tags->getPointsOfInterestList_text(vquery->pointsi,"all"));
ui->textEdit->append(vquery->conf_users->get_userlist_text(vquery->usrs,""));

Example with DB, to tag images of tafwc station at "2018-04-05T01:01"

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");
QDateTime dt_start = QDateTime(2018,04,05);
QDateTime dt_end = dt_start.addDays(1);
imgwc = vquery->select_imgwc_fromall("tafwc",dt_start,dt_end,Json);
ImgsWC imgwc_totag = vquery->imgwc_class->searchImagesWCList(imgwc,"2018-04-05T01:01","");
taggedimgswc = vquery->taggedimgswc_class->prepareTaggListOfImgsWC_db(&imgwc_totag,"ER",5,QPoint(1,2),"CAO","Note_Borrar");
vquery->insert_taggedimgwc_db(&imgwc,taggedimgswc);

Example to tag images of tafwc station at "2018-04-05T01:01"

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");
QDateTime dt_start = QDateTime(2018,04,05);
QDateTime dt_end = dt_start.addDays(1);
imgwc = vquery->select_imgwc_fromall("tafwc",dt_start,dt_end,Json);
ImgsWC imgwc_totag = vquery->imgwc_class->searchImagesWCList(imgwc,"2018-04-05T01:01","");
taggedimgswc = vquery->taggedimgswc_class->prepareTaggListOfImgsWC(&imgwc_totag,"ER",5,QPoint(1,2),"CAO","Note_Borrar",true,Json);
vquery->insert_taggedimgwc(&imgwc,taggedimgswc,Json);

Example with DB, to remove tags at "2018-04-05T01:02"

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");
QDateTime dt_start = QDateTime(2018,04,05);
QDateTime dt_end = dt_start.addDays(1);
imgwc = vquery->select_imgwc_fromall("tafwc",dt_start,dt_end,Json);
ui->textEdit->append(vquery->imgwc_class->getImageWCList_text(imgwc,""));
taggedimgswc = vquery->taggedimgswc_class->getTaggedImgsWCList_json(vquery->config_global.offsetFromUTC,dt_start,dt_end,"",Json);
TaggedImgsWC taggedimgswc_toremove = vquery->taggedimgswc_class->searchInTaggedImgsWC(taggedimgswc,"2018-04-05T01:02");
ui->textEdit->append(vquery->delete_taggedimgwc_db(&imgwc,taggedimgswc_toremove));

Example to remove tags at "2018-04-05T01:02"

vquery = new VolcamQuery();
connect(vquery,SIGNAL(logText(QString)),ui->textEdit,SLOT(append(QString)));
vquery->load_config("");
QDateTime dt_start = QDateTime(2018,04,05);
QDateTime dt_end = dt_start.addDays(1);
imgwc = vquery->select_imgwc_fromall("tafwc",dt_start,dt_end,Json);
ui->textEdit->append(vquery->imgwc_class->getImageWCList_text(imgwc,""));
taggedimgswc = vquery->taggedimgswc_class->getTaggedImgsWCList_json(vquery->config_global.offsetFromUTC,dt_start,dt_end,"",Json);
TaggedImgsWC taggedimgswc_toremove = vquery->taggedimgswc_class->searchInTaggedImgsWC(taggedimgswc,"2018-04-05T01:02");
ui->textEdit->append(vquery->delete_taggedimgwc(&imgwc,taggedimgswc_toremove,Json));

Example to get ImgwC strcutre based on a Json formatted query

squery = "{"
""format": "database","
""datetime_start": "2018-04-11T00:00:00","
""datetime_end": "2018-04-12T00:00:00","
""station": "anawc","
""measured2D_imgwc": "true"
"}";
imgwc = vquery->select_imgwc_fromall(squery);
//Now we could show it:
ui->textEdit->append(vquery->imgwc_class->getImageWCList_textjson(imgwc,""));
//Now we could save it to a json file:
vquery->imgwc_class->saveImagesWCList(imgwc,"./jsonoutput.json",Json);