qq_37934131
qq_37934131
采纳率0%
2017-08-04 06:29 阅读 3.7k

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条回答 默认 最新

  • lx624909677 lx624909677 2017-08-04 06:55

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

    点赞 评论 复制链接分享

相关推荐