storing images in database for template matching?
What is the best way to store image in database for template matching? I considering to store image Mat in database.
What is the best way to store image in database for template matching? I considering to store image Mat in database.
If you can get good enough performance storing them as png or jpg in directories, that is the thing to do. If that isn't fast enough, you may need a real database or a custom file format. No xml or yml approach will be as good as either of those options.
You may need to use OpenCV XML/YAML file storages to store Mat in to file and later read back.
Writing Mat to file
Mat src = imread( "img.jpg",1);
FileStorage Data_W("Data.yml",FileStorage::WRITE); // Store the data in a file
Data_W << "data" << src;
Data_W.release();
Reading back from file
Mat dst;
FileStorage Data_R("Data.yml",FileStorage::READ); // Read traing data to a Mat
Data_R["data"] >> dst;
Data_R.release();
imshow("dst",dst);
waitKey();
@habisravi If you have large set of image and you need to save the space then better to store the images to a folder by compressing it, like jpg. The above method store the pixel value directly to file and no compression uses, and I observed that for large resolution image the file size will be huge, like for the jpg compressed image with resolution 835X668 of size 266 KB the above code created file size of 8.7 MB.
How can I store my images to database and then use for image recognition.
Asked: 2014-01-06 20:16:42 -0600
Seen: 1,761 times
Last updated: Jan 08 '14
Compilation failure in VS2010 (Error C2891) [closed]
Cross-correlation template matching and noise
Database(DBMS) for Computer Vision
Detecting multiple instances of same object with Keypoint-Matching approach
Keypoint matcher matches all keypoints from train to query irrespective of the scene?
Switching from BRISK to FREAK descriptor causes only wrong matches