|
@@ -6,11 +6,29 @@
|
|
|
#include "highgui.h"
|
|
|
#include "cv.h"
|
|
|
#include "resource.h"
|
|
|
-
|
|
|
+#if defined(_MSC_VER)
|
|
|
+#include "atlcore.h"
|
|
|
+static HINSTANCE g_module = NULL;
|
|
|
+#endif //_MSC_VER
|
|
|
|
|
|
LIBIMAGEPROC_API bool imageprocess(char* BackImgPath, char* FrontImgPath, char* ResultImgPath)
|
|
|
{
|
|
|
+#if defined(_MSC_VER)
|
|
|
+ IplImage* pBK = cvCreateImage(cvSize(324, 202), IPL_DEPTH_8U, 3);
|
|
|
+ HBITMAP hBitmap = (HBITMAP)LoadImageA(g_module,
|
|
|
+ MAKEINTRESOURCEA(IDB_BK),
|
|
|
+ IMAGE_BITMAP,
|
|
|
+ 0,
|
|
|
+ 0,
|
|
|
+ LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
|
|
|
+ if (hBitmap) {
|
|
|
+ LONG cb = 324 * 202 * 3;
|
|
|
+ GetBitmapBits(hBitmap, cb, pBK->imageData);
|
|
|
+ DeleteObject(hBitmap);
|
|
|
+ }
|
|
|
+#else
|
|
|
IplImage* pBK = cvLoadImage(BackImgPath, 1);
|
|
|
+#endif //_MSC_VER
|
|
|
|
|
|
IplImage* pfront = cvLoadImage(FrontImgPath, 1);
|
|
|
if (pBK == NULL || pfront == NULL)
|
|
@@ -44,3 +62,20 @@ LIBIMAGEPROC_API bool imageprocess(char* BackImgPath, char* FrontImgPath, char*
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+#if defined(_MSC_VER)
|
|
|
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
|
|
+{
|
|
|
+ switch (ul_reason_for_call) {
|
|
|
+ case DLL_PROCESS_ATTACH:
|
|
|
+ g_module = hModule;
|
|
|
+ DisableThreadLibraryCalls(hModule);
|
|
|
+ break;
|
|
|
+ case DLL_THREAD_ATTACH:
|
|
|
+ case DLL_THREAD_DETACH:
|
|
|
+ case DLL_PROCESS_DETACH:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return TRUE;
|
|
|
+}
|
|
|
+#endif //_MSC_VER
|