-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathImgStore.cpp
42 lines (31 loc) · 1001 Bytes
/
ImgStore.cpp
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
#include "ImgStore.h"
#include <iostream>
#ifndef updatedImage
#define updatedImage first
#define originalImage second
#endif
ImgStore::ImgStore(){
_imgStore = std::unordered_map<std::string, QPair<cv::Mat,cv::Mat>>();
}
ImgStore& ImgStore::get(){
static ImgStore _store;
return _store;
}
void ImgStore::addImage(const std::string& imageName, const cv::Mat& img){
_imgStore[imageName] = qMakePair(img,img.clone());
}
cv::Mat& ImgStore::getImage(const std::string& imageName){
return _imgStore[imageName].updatedImage;
}
cv::Mat& ImgStore::getOriginalImage(const std::string& imageName){
return _imgStore[imageName].originalImage;
}
void ImgStore::updateImage(const std::string& imageName, const cv::Mat& img){
_imgStore[imageName].updatedImage = img;
}
bool ImgStore::check_Key(const std::string& imageName){
return (_imgStore.find(imageName) != _imgStore.end());
}
void ImgStore::deleteImage(const std::string& imageName){
_imgStore.erase(imageName);
}