#include #include #include #include "PolyToQImage.h" #include using namespace vcg; using namespace std; void rectSetToPolySet(vector< Box2f > &rectVec, vector< vector > &polyVec) { polyVec.clear(); for(size_t i=0;i > &polyVec, PolyDumperParam &pp) { Box2f bb; for(size_t i=0;i trVec(polyVec.size(),sim); dumpPolySet(imageName,polyVec,trVec,pp); } void dumpPolySet(const char * imageName, vector< vector > &polyVec, vector &trVec, PolyDumperParam &pp) { vector< vector< vector > > polyVecVec(polyVec.size()); for(size_t i=0;i labelVec(polyVec.size()); dumpPolySet(imageName,polyVecVec,trVec,labelVec,pp); } void dumpPolySet(const char * imageName, vector< vector< vector > > &polyVecVec, vector &trVec, vector &labelVec, PolyDumperParam &pp) { assert(polyVecVec.size() == trVec.size()); QFont qf("courier",1); QSvgGenerator svg; svg.setFileName(imageName); // pp.widthPx = pp.widthDot; // pp.heightPx = pp.heightDot; svg.setSize(QSize(pp.widthMm,pp.heightMm)); svg.setResolution(pp.dpi); // ?? dpm or dpi QImage img(pp.widthPx,pp.heightPx,QImage::Format_RGB32); img.fill(vcg::ColorConverter::ToQColor( pp.backgroundColor).rgb()); QPainter painter; if(QString(imageName).endsWith("svg",Qt::CaseInsensitive)) painter.begin(&svg); else painter.begin(&img); QBrush bb; QPen qp; qp.setWidth(0); // printf("polyVecVec.size() = %i \n",polyVecVec.size()); for(size_t i=0;i ppQ; for(int j=0;j