无法从PHP执行c ++ opencv函数

时间:2015-08-01 05:03:32

标签: php c++ opencv

我想让我的c ++程序在PHP中运行。在下面的程序中,我想首先确保程序可以执行

#include <iostream>
#include "opencv/cv.h"
#include "opencv/highgui.h"

using namespace cv;

int main(int argc, char *argv[])
{
Mat  imgOk = imread("C:/xampp/htdocs/coba2/src.jpg", 1);
imwrite("res.jpg", imgOk);
printf("hello");
return 0;
}

我是从

打来的
<?php
exec('bin\\Debug\\co.exe', $output);

print_r(array_values($output));

?>

网页上的结果仅为

Array()

图像未保存

我还尝试了passthru()system()shell_exec(),但这些都没有效果

当我尝试

 #include <iostream>
 #include "opencv/cv.h"
 #include "opencv/highgui.h"

using namespace cv;

int main(int argc, char *argv[])
{
printf("hello");
return 0;
}

一切正常

数组([0] =&gt;你好)

任何解决方案?

1 个答案:

答案 0 :(得分:-1)

也许将OpenCV DLL复制到bin \ Debug目录?您可以在OpenCV安装目录中找到它们。