-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_helper.cpp
51 lines (43 loc) · 1.04 KB
/
image_helper.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
42
43
44
45
46
47
48
49
50
51
#include "image_helper.h"
#include <wx/numdlg.h>
#include "image_util.h"
std::string convertWxStringToString(const wxString wsx)
{
std::stringstream s;
s << wsx;
return s.str();
}
void CImageHelper::clean()
{
original_initiated = false;
if (Final_ImageOpenCVFormat.empty() == false)
{
Final_ImageOpenCVFormat.deallocate();
}
if (Original_ImageOpenCVFormat.empty() == false)
{
Original_ImageOpenCVFormat.deallocate();
}
}
Mat CImageHelper::SetOriginalNew()
{
Mat savefinal;
savefinal = Final_ImageOpenCVFormat.clone();
destroyAllWindows();
clean();
cv::namedWindow("Final", cv::WINDOW_NORMAL);
setOrginalImageOpenCV(savefinal);
original_initiated = true;
return savefinal;
}
bool CImageHelper::SaveImage(std::string& Path)
{
wxString s = convertWxStringToString(Path);
Mat final_image = getFinalImageOpenCV();
std::string spath = convertWxStringToString(Path);
if (saveImage(spath, final_image))
{
return true;
}
return false;
}