Opencv split(frame,std::Vector<cv::Mat>) crashed
Hi,
I try to create dll using opencv methods for unity but I run my dll with split function ,my app crash
extern "C" void __declspec(dllexport) __stdcall Test()
{
Mat frame;
capture >> frame;
if (frame.empty())
return;
std::vector<Mat> channels(3);
split(frame, channels);
}
I cant use Vector in split ,I try like below
extern "C" void __declspec(dllexport) __stdcall Test()
{
Mat frame;
capture >> frame;
if (frame.empty())
return;
Mat channels[3];
split(frame, channels);
}
it works but I need to use vector version How can I solve my problem ?
please help me :(
try:
std::vector<Mat> channels;
, notstd::vector<Mat> channels(3);
Okay there are still some issues
if (frame.empty()){ return; }
. If not, your code will always hit the return and do nothing.channles
should bechannels
.thanks berak , I tried std::vector<mat> channels but it didnt work tooo
Hi Steven, important issue is not syntax error :D I have controled possiblity which my frame is empty
@zehra, we cannot help you if all you can say is "did not work". we need an exact error message.
@berak ok it means application crashed in unity and send output_log message :
opencv_core2412.dll caused an Access Violation (0xc0000005) in module opencv_core2412.dll at 0033:ef451bd5.
@zehra, have a look at your linker settings, make sure to use opencv release libs only with release build, and also make sure, you use the same crt for the dll and your app.
also, which vs version do you use ? did you build the opencv libs locally ? (and why on earth outdated 2412 ?)
What happens when you do this: