1 | initial version |
i made a quick try with your image, results are shabby ;(
wget --no-check-certificate https://github.com/Itseez/open
cv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
2 | No.2 Revision |
i made a quick try with your image, results are shabby so-la-la ;(
wget --no-check-certificate https://github.com/Itseez/open
cv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
3 | No.3 Revision |
i made a quick try with your image, results are so-la-la ;(
wget --no-check-certificate
https://github.com/Itseez/open
cv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xmlhttps://github.com/Itseez/opencv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
4 | No.4 Revision |
i made a quick try (dpm) with your image, results are so-la-la ;(
wget --no-check-certificate https://github.com/Itseez/opencv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
5 | No.5 Revision |
i made a quick try (dpm) with your image, results are so-la-la ;(
wget --no-check-certificate https://github.com/Itseez/opencv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
#include <opencv2/dpm.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace cv::dpm;
using namespace std;
int main( int argc, char** argv )
{
vector<string> models;
vector<string> names;
//names.push_back("car");
//models.push_back("car.xml");
names.push_back("cow");
models.push_back("cow.xml");
cv::Ptr<DPMDetector> detector = DPMDetector::create(models,names);
cerr << "loaded " << models.size() << " models" << endl;
Mat frame = imread("cow.png");
resize(frame,frame,Size(),2,2);
namedWindow("DPM Cascade Detection", 1);
// the color of the rectangle
Scalar color[3] = { Scalar(0, 255, 255), Scalar(0, 255, 0), Scalar(0, 0, 255) };
double t = (double) getTickCount();
// detection
vector<DPMDetector::ObjectDetection> ds;
detector->detect(frame.clone(), ds); // it somehow eats the image ;(
t = ((double) getTickCount() - t)/getTickFrequency();//elapsed time
cerr << "dpm took " << t << " seconds" << endl;
for (unsigned int i = 0; i < ds.size(); i++)
{
int id = ds[i].classID;
cerr << names[id] << "\t" << ds[i].score << "\t" << ds[i].rect << endl;
//if (ds[i].score < -0.95)
// continue;
rectangle(frame, ds[i].rect, Scalar(0, 255, 255), 1);
}
imshow("DPM Cascade Detection", frame);
imwrite("cow_det.png", frame);
waitKey(0);
return 0;
}
6 | No.6 Revision |
i made a quick try (dpm) with your image, results are so-la-la ;(
wget --no-check-certificate https://github.com/Itseez/opencv_extra/raw/master/testdata/cv/dpm/VOC2007_Cascade/cow.xml
and for this i already had to crop it to a small part (low mem here) and upscale by a factor of 2
#include <opencv2/dpm.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace cv::dpm;
using namespace std;
int main( int argc, char** argv )
{
// you can load/detect several cascades at once.
vector<string> models;
vector<string> names;
//names.push_back("car");
//models.push_back("car.xml");
names.push_back("cow");
models.push_back("cow.xml");
cv::Ptr<DPMDetector> detector = DPMDetector::create(models,names);
cerr << "loaded " << models.size() << " models" << endl;
Mat frame = imread("cow.png");
resize(frame,frame,Size(),2,2);
namedWindow("DPM Cascade Detection", 1);
// the color of the rectangle
Scalar color[3] = { Scalar(0, 255, 255), Scalar(0, 255, 0), Scalar(0, 0, 255) };
1);
double t = (double) getTickCount();
// detection
vector<DPMDetector::ObjectDetection> ds;
detector->detect(frame.clone(), ds); // it somehow eats the image ;(
t = ((double) getTickCount() - t)/getTickFrequency();//elapsed time
cerr << "dpm took " << t << " seconds" << endl;
for (unsigned int i = 0; i < ds.size(); i++)
{
int id = ds[i].classID;
cerr << names[id] << "\t" << ds[i].score << "\t" << ds[i].rect << endl;
//
// there's a "<ScoreThreshold>" tag hidden in the xml !
//
//if (ds[i].score < -0.95)
// continue;
rectangle(frame, ds[i].rect, Scalar(0, 255, 255), 1);
}
imshow("DPM Cascade Detection", frame);
imwrite("cow_det.png", frame);
waitKey(0);
return 0;
}