libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/test floodfill_test.cc


From: Edward Rosten
Subject: [libcvd-members] libcvd/test floodfill_test.cc
Date: Wed, 11 Feb 2009 10:39:52 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        09/02/11 10:39:52

Added files:
        test           : floodfill_test.cc 

Log message:
        Test program for finding bugs in connected_components.
        
        There is a bug.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/test/floodfill_test.cc?cvsroot=libcvd&rev=1.1

Patches:
Index: floodfill_test.cc
===================================================================
RCS file: floodfill_test.cc
diff -N floodfill_test.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ floodfill_test.cc   11 Feb 2009 10:39:52 -0000      1.1
@@ -0,0 +1,43 @@
+#include <iostream>
+#include <cvd/connected_components.h>
+#include <cvd/image.h>
+
+using namespace std;
+using namespace CVD;
+
+int main()
+{
+       for(int i=0; i < (1<<9); i++)
+       {
+               cout << "------------------------\n" << i << endl;
+               int j=i;
+               vector<ImageRef> p;
+               for(int y=0; y < 3; y++)
+                       for(int x=0; x < 3; x++)
+                       {
+                               if(j&1)
+                                       p.push_back(ImageRef(x, y));
+                               j>>=1;
+                       }
+
+               vector<vector<ImageRef> > v;
+               connected_components(p, v);
+
+               Image<char> im(ImageRef(3,3), '.');
+
+               for(unsigned int j=0; j <v.size(); j++)
+                       for(unsigned int k=0; k <v[j].size(); k++)
+                               im[v[j][k]]=65+j;
+               
+               cout << "Created " << v.size() << " groups\n";
+               cout.write(im.data(), 3);
+               cout << endl;
+               cout.write(im.data()+3, 3);
+               cout << endl;
+               cout.write(im.data()+6, 3);
+               cout << endl;
+               cout << endl;
+               cin.get();
+       }
+
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]