Commit 94f92d20 authored by Michael Murtaugh's avatar Michael Murtaugh

tweeeeks

parent 6298c2ed
......@@ -39,7 +39,9 @@ int main(int argc, char** argv)
printf("<g class=\"houghlines\">\n");
printf(" <!-- %d total lines -->\n", lines.size());
fprintf(stderr, "%d total lines\n", lines.size());
// fprintf(stderr, "%d total lines\n", lines.size());
// CSV headers
fprintf(stderr, "type,angle,x1,y1,x2,y2\n");
for( size_t i = 0; i < lines.size(); i++ )
{
double Angle = atan2(lines[i][3]- lines[i][1], lines[i][2]- lines[i][0]) * 180.0 / CV_PI;
......@@ -47,13 +49,13 @@ int main(int argc, char** argv)
double dv = abs(abs(Angle) - 90);
if (dh < 5) {
printf(" <line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"horizontal\" />\n", lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "H angle:%0.1f line:%d,%d to %d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "horizontal,%0.1f,%d,%d,%d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
} else if (dv < 5) {
printf(" <line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" class=\"vertical\" />\n", lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "V angle:%0.1f line:%d,%d to %d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "vertical,%0.1f,%d,%d,%d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
} else {
printf(" <line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n", lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "l angle:%0.1f line:%d,%d to %d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
fprintf(stderr, "line,%0.1f,%d,%d,%d,%d\n", Angle, lines[i][0], lines[i][1], lines[i][2], lines[i][3]);
}
// if(abs(Angle)>=0 && abs(Angle)<=5) {
// could also consider:
......
......@@ -72,7 +72,8 @@ int main(int argc, char** argv)
fprintf(stderr, "SYM:'%s', conf: %.2f; BoundingBox: %d,%d,%d,%d; psize: %d, font id: %d\n", word, conf, x1, y1, x2, y2, psize, fid);
if(conf>50) {
// printf(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/>\n", x1, y1, (x2-x1), (y2-y1));
fprintf(f, " <g class=\"symbol\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), psize/2, word);
// fprintf(f, " <g class=\"symbol\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), psize/2, word);
fprintf(f, " <g class=\"symbol\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), 12, word);
// printf(" <g class=\"word\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"0\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), word);
confidence_level+=conf;
j++;
......@@ -110,7 +111,8 @@ int main(int argc, char** argv)
fprintf(stderr, "WORD:'%s', conf: %.2f; BoundingBox: %d,%d,%d,%d; psize: %d, font id: %d\n", word, conf, x1, y1, x2, y2, psize, fid);
if(conf>50) {
// printf(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\"/>\n", x1, y1, (x2-x1), (y2-y1));
fprintf(f, " <g class=\"word\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), psize/2, word);
//fprintf(f, " <g class=\"word\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), psize/2, word);
fprintf(f, " <g class=\"word\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"%d\" style=\"font-size: %dpx\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), (y2-y1), 12, word);
// printf(" <g class=\"word\" transform=\"translate(%d,%d)\"><rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"/><text x=\"0\" y=\"0\"><![CDATA[%s]]></text></g>\n", x1, y1, (x2-x1), (y2-y1), word);
confidence_level+=conf;
j++;
......
......@@ -34,6 +34,7 @@ tvars['width'] = im.size[0]
tvars['height'] = im.size[1]
maxzoom, sw, sh = check_height(im, args.tilesize)
tvars['maxzoom'] = maxzoom
tvars['tilesize'] = args.tilesize
if args.output:
with open(args.output, "w") as f:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment