1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| for(Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol)
{
vector<Point> vp;
// do something useful with results
cout << "decoded " << symbol->get_type_name() << " symbol \"" << symbol->get_data() << "\"" << endl;
system("mpc clear");
system((std::string("mpc add ")+ "\"" + symbol->get_data()+ "\"").c_str());
system("mpc play");
// idéalement une petite pause ici, histoire de ne pas prendre en compte le qr code plusieurs fois.....
int n = symbol->get_location_size();
for(int i=0;i<n;i++)
{
vp.push_back(Point(symbol->get_location_x(i), symbol->get_location_y(i)));
}
RotatedRect r = minAreaRect(vp);
Point2f pts[4];
r.points(pts);
for(int i=0;i<4;i++){
line(frame, pts[i], pts[(i+1)%4], Scalar(255,0,0), 3);
}
cout<<"Angle: "<<r.angle<<endl;
} |