1 // This is brl/bseg/betr/tests/test_edgel_factory.cxx
2 #include <iostream>
3 #include <fstream>
4 #include "testlib/testlib_test.h"
5 #include <betr/betr_edgel_factory.h>
6 #include "vil/vil_load.h"
7 #include <bsta/bsta_histogram.h>
8 #include <vsol/vsol_point_2d.h>
9 #include <vsol/vsol_polygon_2d.h>
test_edgel_factory()10 void test_edgel_factory()
11 {
12 vsol_point_2d_sptr p0 = new vsol_point_2d(94.9259, 347.247);
13 vsol_point_2d_sptr p1 = new vsol_point_2d(134.333, 354.062);
14 vsol_point_2d_sptr p2 = new vsol_point_2d(110.037, 379.247);
15 vsol_point_2d_sptr p3 = new vsol_point_2d(89, 376.284);
16 std::vector<vsol_point_2d_sptr> verts;
17 verts.push_back(p0); verts.push_back(p1); verts.push_back(p2); verts.push_back(p2);
18 vsol_polygon_2d_sptr poly = new vsol_polygon_2d(verts);
19 // D:/tests/chiletest/crop_dir/09DEC06145803-P1BS-052869858050_01_P002_bin_2.tif
20 std::string img_dir = "D:/tests/chiletest/crop_dir/";
21 std::string image_name = "09DEC06145803-P1BS-052869858050_01_P002_bin_2";
22 std::string img_path = img_dir + image_name + ".tif";
23 betr_edgel_factory efact;
24 vil_image_resource_sptr imgr = vil_load_image_resource(img_path.c_str());
25 bool good = efact.add_image(image_name, imgr);
26 unsigned i0 = 290, j0 = 330;
27 unsigned ni = 80, nj = 80;
28 std::string region_name = "test_region";
29 // good = good && efact.add_region_from_origin_and_size(image_name, region_name,ni0, j0, ni, nj);
30 good = good && efact.add_region(image_name, region_name, poly);
31 good = good && efact.process(image_name, region_name);
32 const bsta_histogram<double>& h = efact.hist(image_name, region_name);
33 std::cout << "edgel strength\n";
34 h.print();
35 std::cout << '\n';
36 }
37
38 TESTMAIN(test_edgel_factory);
39