25.02.2016, 13:52
Hello,
I think that there is a memory alloc problem, hope you can help me.
VI Module:
http://postimg.org/image/awk7zj8yb
http://postimg.org/image/riz35ukux
I think that there is a memory alloc problem, hope you can help me.
Code:
#include <windows.h>
#include <extcode.h>
#include <iostream>
#include <stdio.h>
#include "opencv2/core.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
using namespace cv;
using namespace std;
// --- Dll entry point ---
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
UNREFERENCED_PARAMETER(hModule);
UNREFERENCED_PARAMETER(lpReserved);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
__declspec(dllexport) INT myDoSomething(short* M, short* N, short* image, int SizeX, int SizeY, short* imgOut){
// Alloc Memory
Mat imgIn(SizeX, SizeY, CV_16S, &image[0]);
Mat imOut(SizeX, SizeY, CV_16S, &imgOut[0]);
// Clone Source Image
imOut = imgIn.clone();
// Get size for DFT
*M = getOptimalDFTSize(imgIn.rows);
*N = getOptimalDFTSize(imgIn.cols);
return 0;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
VI Module:
http://postimg.org/image/awk7zj8yb
http://postimg.org/image/riz35ukux