#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <QtCore>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat src = imread(String("qrc://balls.jpg"), CV_LOAD_IMAGE_COLOR);
if (src.empty())
{
cout << "cannot load" << endl;
return -1;
}
Mat hsv;
cvtColor(src, hsv, CV_BGR2HSV);
Mat bw;
inRange(hsv, Scalar(19, 204, 153), Scalar(27, 255, 255), bw);
vector<vector<Point> > contours;
findContours(bw.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
Mat dst = Mat::zeros(src.size(), src.type());
drawContours(dst, contours, -1, Scalar::all(255), CV_FILLED);
dst &= src;
imshow("src", src);
imshow("dst", dst);
waitKey(0);
int a;
cin >> a;
return 0;
}
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <QtCore>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat src = imread(String("qrc://balls.jpg"), CV_LOAD_IMAGE_COLOR);
if (src.empty())
{
cout << "cannot load" << endl;
return -1;
}
Mat hsv;
cvtColor(src, hsv, CV_BGR2HSV);
Mat bw;
inRange(hsv, Scalar(19, 204, 153), Scalar(27, 255, 255), bw);
vector<vector<Point> > contours;
findContours(bw.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
Mat dst = Mat::zeros(src.size(), src.type());
drawContours(dst, contours, -1, Scalar::all(255), CV_FILLED);
dst &= src;
imshow("src", src);
imshow("dst", dst);
waitKey(0);
int a;
cin >> a;
return 0;
}
To copy to clipboard, switch view to plain text mode
and resource file
<RCC>
<qresource prefix="/">
<file>balls.jpg</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/">
<file>balls.jpg</file>
</qresource>
</RCC>
To copy to clipboard, switch view to plain text mode
but it never load image i dont know what is wrong
Bookmarks