qt编程中opencv2/core/utility.hpp没有那个文件或目录

#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include "stdio.h"

#include
#include

using namespace cv;
using namespace std;

Mat img=imread("home/zhangjinyu/lunkuo.jpeg");
int main(int argc, const char** argv)
{

Mat labels;
int num_objects=connectedComponents(img,labels);
if(num_objects<2)
{
cout <<"no objects detected"<<endl;

}
  else{
       cout<<"number of objects detected:"<<endl;
        }

Mat output = Mat :: zeros(img.rows,img.cols,CV_8UC3);
RNG rng(0xffffffff);
for(int i=1;i<num_objects;i++)
{
Mat mask =labels==i;
output.setTo(random_color(rng),mask);

}
       imshow("result",output);
       waitKey(30);

}

1个回答

opencv不属于qt是第三方库,需要下载opencv库

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐