Hello guys
I have an application for face detection and recognition using OpenCV library and Qt (for multithreading and to handle XML files). When I run the app, it detects face and there is possibility to save it as a picture to a file. It happens after I click on button (see the code). Now I would like to add connection to a database, so after I click the button, it connects to the db, asks for name of the person, surname, ID- primary key (maybe could be automatical using incrementation) and last column would be picture of the detected face. I read it is not good to store image (as a blob type) in a db and it is better to save reference to where picture is saved. I have no experience with databases and this stuff and have no idea how to implement it. Accually I dont know if it is even possible but I hope so... Any ideas how could I do it?
Thanks a lot
void VisualControl::captureTrainingImage()
{
cv::Mat frame;
cognition::Detector::RectVector faces;
captureFrameAndFaces(faces, frame);
if(faces.size() == 0)
{
QMessageBox::information(this, "Face not found", "Detector did not detect face");
}
else
{
frame = frame.clone();
cognition::TrainerImage convertor(testImageSize, true, "images/");
cv::Mat faceRegion;
for(std::vector<cv::Rect>::iterator face = faces.begin(); face != faces.end(); ++face)
{
faceRegion = frame(*face);
QString filename = QInputDialog::getText(this,
tr("Picture name"),
tr("Enter the picture name with extension"));
if(filename.size() < 1) continue;
if(!convertor.processAndSaveImage(faceRegion, filename.toStdString()))
QMessageBox::information(this, "Error", "Try again");
}
}
}