[英]Can't execute c++ opencv function from PHP
我想讓我的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));
?>
網頁上的結果只有
數組()
而且圖像沒有保存
我也嘗試過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] => hello)
有什么辦法嗎?
也許將OpenCV DLL復制到bin \\ Debug目錄? 您可以在OpenCV安裝目錄中找到它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.