int balancer_display(FILE *stream) { int i, ret = 0; for (i = 0; i < n_locations; i++) (void)stop_accumulator(&locations[i].accumulator); for (i = 0; i < n_locations; i++) { ret += fprintf(stream, "Statistics for URL %d: %s\n", i + 1, locations[i].uristr); if (n_locations == 1) return ret; ret += print_accumulator(stream, &locations[i].accumulator); ret += fprintf(stream, "\n"); } return ret; }
/** * USE: Provide sample points and how many to setup_hough() transformation and plot those points * using plot_point() with each index of points you want to convert. The use print_classifier() * or get_lines() to see the lines extracted. */ int main(int argc, char **argv) { // Get points from image SIZE_TYPE size; POINT_TYPE *points = NULL; sizep_t count = get_points("sample_small.bmp", &points, &size); /* * points : Array of points * num_points : Number of points in the array * threshold : Threshold to consider line intersection * tolerance_t : Tolerance (in grades) to consider two lines are the same * tolerance_r : Distance (in pixels) to consider two lines are the same * precision : Precision for degrees (10 = decimals, 100 = cents...) * size : Size of the image * max_lines : Lines to look for (value -1 falls back to 500) */ clock_t cp = clock(); setup_hough(points, count, 12, 15.0, 5.0, 1, size, 10000); // Plot every point and measure clock ticks int n; for (n=0; n<_num_points; n++) { plot_point(n); } printf("_plot_point() ticks: %.4f\n", ((double)(clock()-cp))/1000000l); print_accumulator("accumulator.bmp"); print_classifier();//*/ // Get lines from classifier LINE_TYPE *lines; sizep_t clines = get_lines(&lines); // Print lines print_lines("output.bmp", "sample.bmp", lines, clines, 10); print_lines("output_small.bmp", "sample_small.bmp", lines, clines, 1); // Free memory finish_hough(); free(lines); free(points); printf("All clear!"); return EXIT_SUCCESS; }