-1
我實際上在OpenCV中存在Iterator問題。我正在從LabView讀取圖像並將其存儲在Mat imgIn中。之後,我爲圖像處理Mat imOut創建了第二個Mat。當我克隆它並嘗試將其發送回LabView時,我得到一張黑色圖像,因此沒有發送任何信息。OpenCV MatIterator錯誤
#include <windows.h>
#include "extcode.h"
#include <iostream>
#include <stdio.h>
#include "opencv2/opencv.hpp"
#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);
MatIterator_ it;// = imOut.begin<short>();
//for(int x=0;x<=SizeX;x++){
//imgOut = imOut.at<short>(x,y);
//}
return 0;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
在LabView中一切都是正確的。 VS錯誤:
Fehler 1 error C2955: "cv::MatIterator_": Für die Verwendung der template-Klasse ist eine template-Argumentliste erforderlich.