TestImageTools.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /*
  2. * NICE-Core - efficient algebra and computer vision methods
  3. * - libimage - An image/template for new NICE libraries
  4. * See file License for license information.
  5. */
  6. #ifdef NICE_USELIB_CPPUNIT
  7. #include "TestImageTools.h"
  8. #include <string>
  9. #include "core/image/ImageTools.h"
  10. //#include "core/image/Filter.h"
  11. #include "core/image/LineT.h"
  12. #ifdef NICE_USELIB_LIMUN_IOCOMPRESSION
  13. #include <iocompression/md5.h>
  14. #endif
  15. using namespace std;
  16. using namespace NICE;
  17. CPPUNIT_TEST_SUITE_REGISTRATION( TestImageTools );
  18. void TestImageTools::setUp()
  19. {
  20. }
  21. void TestImageTools::tearDown()
  22. {
  23. }
  24. void TestImageTools::testaddConstBorder()
  25. {
  26. #ifdef NICE_USELIB_IPP
  27. Image test(3,5);
  28. test(2,4)=128;
  29. test(1,3)=128;
  30. test(0,0)=128;
  31. Image testwithborder;
  32. addConstBorder(test,4,2,(Ipp8u)(255),&testwithborder);
  33. std::string fileName("whiteborder.png");
  34. testwithborder.write(ImageFile(fileName));
  35. #ifdef NICE_USELIB_LIMUN_IOCOMPRESSION
  36. CPPUNIT_ASSERT_MD5_FILE("d41d8cd98f00b204e9800998ecf8427e","whiteborder.pgm");
  37. #endif
  38. remove(fileName.c_str());
  39. #endif //NICE_USELIB_IPP
  40. }
  41. void TestImageTools::testautoCropRect()
  42. {
  43. Image test(41,37);
  44. test=0;
  45. Rect rect;
  46. Ipp8u value=2;
  47. autoCropRect(test,value,rect);
  48. CPPUNIT_ASSERT_EQUAL(Rect(0,0,0,0),rect);
  49. test(10,7)=3;
  50. autoCropRect(test,value,rect);
  51. CPPUNIT_ASSERT_EQUAL(Rect(10,7,1,1),rect);
  52. test(10,15)=3;
  53. autoCropRect(test,value,rect);
  54. CPPUNIT_ASSERT_EQUAL(Rect(10,7,1,9),rect);
  55. test(15,5)=3;
  56. autoCropRect(test,value,rect);
  57. CPPUNIT_ASSERT_EQUAL(Rect(10,5,6,11),rect);
  58. }
  59. void TestImageTools::testfindLocalMinima()
  60. {
  61. Image test(64,64);
  62. for(int y=0;y<64;y++) {
  63. for(int x=0;x<64;x++) {
  64. test(x,y)=4*(x%16+y%16);
  65. }
  66. }
  67. {
  68. Ipp8u thresh=40;
  69. std::vector<Coord> minima;
  70. findLocalMinima(test, thresh, 10, minima);
  71. Image test2(test);
  72. for(uint i=0;i<minima.size();i++) {
  73. test2(minima[i])=255;
  74. }
  75. test2.write(ImageFile("testfindLocalMinima.pgm"));
  76. #ifdef NICE_USELIB_LIMUN_IOCOMPRESSION
  77. CPPUNIT_ASSERT_MD5_FILE("ae5d33b62395a8c4db8e4c8780d854d8","testfindLocalMinima.pgm");
  78. #endif
  79. system("rm -f testfindLocalMinima.pgm");
  80. }
  81. {
  82. Ipp8u thresh=100;
  83. std::vector<Coord> minima;
  84. findLocalMinima(test, thresh, 30, minima);
  85. Image test2(test);
  86. for(uint i=0;i<minima.size();i++) {
  87. test2(minima[i])=255;
  88. }
  89. test2.write(ImageFile("testfindLocalMinima2.pgm"));
  90. #ifdef NICE_USELIB_LIMUN_IOCOMPRESSION
  91. CPPUNIT_ASSERT_MD5_FILE("a8ff018660e40252b6794f4e03128b42","testfindLocalMinima2.pgm");
  92. #endif
  93. system("rm -f testfindLocalMinima2.pgm");
  94. }
  95. }
  96. void TestImageTools::testabsDiff()
  97. {
  98. // Image: absDiff
  99. {
  100. // exception
  101. CPPUNIT_ASSERT_THROW(absDiff(Image(1,1), Image(3,4)), ImageException);
  102. //
  103. Image src1(3,3), src2(3,3);
  104. src1(0,0) = 3; src1(1,0) = 81; src1(2,0) = 0;
  105. src1(0,1) = 12; src1(1,1) = 8; src1(2,1) = 1;
  106. src1(0,2) = 9; src1(1,2) = 18; src1(2,2) = 38;
  107. src2(0,0) = 18; src2(1,0) = 39; src2(2,0) = 0;
  108. src2(0,1) = 37; src2(1,1) = 5; src2(2,1) = 2;
  109. src2(0,2) = 3; src2(1,2) = 1; src2(2,2) = 1;
  110. Image* result = absDiff(src1, src2);
  111. CPPUNIT_ASSERT_EQUAL( 15, static_cast<int>(result->getPixel(0,0)));
  112. CPPUNIT_ASSERT_EQUAL( 25, static_cast<int>(result->getPixel(0,1)));
  113. CPPUNIT_ASSERT_EQUAL( 6, static_cast<int>(result->getPixel(0,2)));
  114. CPPUNIT_ASSERT_EQUAL( 42, static_cast<int>(result->getPixel(1,0)));
  115. CPPUNIT_ASSERT_EQUAL( 3, static_cast<int>(result->getPixel(1,1)));
  116. CPPUNIT_ASSERT_EQUAL( 17, static_cast<int>(result->getPixel(1,2)));
  117. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(2,0)));
  118. CPPUNIT_ASSERT_EQUAL( 1, static_cast<int>(result->getPixel(2,1)));
  119. CPPUNIT_ASSERT_EQUAL( 37, static_cast<int>(result->getPixel(2,2)));
  120. }
  121. // ColorImage: absDiff
  122. {
  123. // exception
  124. CPPUNIT_ASSERT_THROW(absDiff(ColorImage(1,1), ColorImage(3,4)), ImageException);
  125. //
  126. ColorImage src1(3,3), src2(3,3);
  127. for(int i=0; i<3; ++i)
  128. {
  129. src1(0,0,i) = 3; src1(1,0,i) = 81; src1(2,0,i) = 0;
  130. src1(0,1,i) = 12; src1(1,1,i) = 8; src1(2,1,i) = 1;
  131. src1(0,2,i) = 9; src1(1,2,i) = 18; src1(2,2,i) = 38;
  132. src2(0,0,i) = 18; src2(1,0,i) = 39; src2(2,0,i) = 0;
  133. src2(0,1,i) = 37; src2(1,1,i) = 5; src2(2,1,i) = 2;
  134. src2(0,2,i) = 3; src2(1,2,i) = 1; src2(2,2,i) = 1;
  135. }
  136. ColorImage* result = absDiff(src1, src2);
  137. for(int i=0; i<3; ++i)
  138. {
  139. CPPUNIT_ASSERT_EQUAL( 15, static_cast<int>(result->getPixel(0,0,i)));
  140. CPPUNIT_ASSERT_EQUAL( 25, static_cast<int>(result->getPixel(0,1,i)));
  141. CPPUNIT_ASSERT_EQUAL( 6, static_cast<int>(result->getPixel(0,2,i)));
  142. CPPUNIT_ASSERT_EQUAL( 42, static_cast<int>(result->getPixel(1,0,i)));
  143. CPPUNIT_ASSERT_EQUAL( 3, static_cast<int>(result->getPixel(1,1,i)));
  144. CPPUNIT_ASSERT_EQUAL( 17, static_cast<int>(result->getPixel(1,2,i)));
  145. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(2,0,i)));
  146. CPPUNIT_ASSERT_EQUAL( 1, static_cast<int>(result->getPixel(2,1,i)));
  147. CPPUNIT_ASSERT_EQUAL( 37, static_cast<int>(result->getPixel(2,2,i)));
  148. }
  149. }
  150. }
  151. void TestImageTools::testBoolean()
  152. {
  153. // Image: and
  154. {
  155. // exception
  156. CPPUNIT_ASSERT_THROW(And(Image(1,1), Image(3,4)), ImageException);
  157. //
  158. Image srcAnd(8,8);
  159. for(int y=0; y<srcAnd.height(); ++y)
  160. for(int x=0; x<srcAnd.width(); ++x)
  161. srcAnd.setPixelQuick(x,y, (x+1)+y*srcAnd.width());
  162. Image src(srcAnd.width(), srcAnd.height());
  163. Image* result;
  164. src.set(1);
  165. result = And(srcAnd, src);
  166. for(int y=0; y<srcAnd.height(); ++y)
  167. for(int x=0; x<srcAnd.width(); ++x)
  168. if(x%2==0)
  169. CPPUNIT_ASSERT_EQUAL( 1, static_cast<int>(result->getPixel(x,y)));
  170. else
  171. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y)));
  172. src.set(2);
  173. result = And(srcAnd, src);
  174. for(int y=0; y<srcAnd.height(); ++y)
  175. for(int x=0; x<srcAnd.width(); ++x)
  176. if(x==1 || x==2 || x==5 || x==6)
  177. CPPUNIT_ASSERT_EQUAL( 2, static_cast<int>(result->getPixel(x,y)));
  178. else
  179. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y)));
  180. src.set(4);
  181. result = And(srcAnd, src);
  182. for(int y=0; y<srcAnd.height(); ++y)
  183. for(int x=0; x<srcAnd.width(); ++x)
  184. if(x>=3 && x<=6)
  185. CPPUNIT_ASSERT_EQUAL( 4, static_cast<int>(result->getPixel(x,y)));
  186. else
  187. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y)));
  188. src.set(8);
  189. result = And(srcAnd, src);
  190. for(int y=0; y<srcAnd.height(); ++y)
  191. for(int x=0; x<srcAnd.width(); ++x)
  192. if( (y%2==1&&x!=7) || (y%2==0&&x==7) )
  193. CPPUNIT_ASSERT_EQUAL( 8, static_cast<int>(result->getPixel(x,y)));
  194. else
  195. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y)));
  196. }
  197. // ColorImage: absDiff
  198. {
  199. // exception
  200. CPPUNIT_ASSERT_THROW(And(ColorImage(1,1), ColorImage(3,4)), ImageException);
  201. //
  202. ColorImage srcAnd(8,8);
  203. for(int y=0; y<srcAnd.height(); ++y)
  204. for(int x=0; x<srcAnd.width(); ++x)
  205. for(int i=0; i<3; ++i)
  206. srcAnd.setPixelQuick(x,y,i, (x+1)+y*srcAnd.width());
  207. ColorImage src(8,8);
  208. ColorImage* result;
  209. src.set(1,1,1);
  210. result = And(srcAnd, src);
  211. for(int y=0; y<srcAnd.height(); ++y)
  212. for(int x=0; x<srcAnd.width(); ++x)
  213. for(int i=0; i<3; ++i)
  214. if(x%2==0)
  215. CPPUNIT_ASSERT_EQUAL( 1, static_cast<int>(result->getPixel(x,y,i)));
  216. else
  217. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y,i)));
  218. src.set(2,2,2);
  219. result = And(srcAnd, src);
  220. for(int y=0; y<srcAnd.height(); ++y)
  221. for(int x=0; x<srcAnd.width(); ++x)
  222. for(int i=0; i<3; ++i)
  223. if(x==1 || x==2 || x==5 || x==6)
  224. CPPUNIT_ASSERT_EQUAL( 2, static_cast<int>(result->getPixel(x,y,i)));
  225. else
  226. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y,i)));
  227. src.set(4,4,4);
  228. result = And(srcAnd, src);
  229. for(int y=0; y<srcAnd.height(); ++y)
  230. for(int x=0; x<srcAnd.width(); ++x)
  231. for(int i=0; i<3; ++i)
  232. if(x>=3 && x<=6)
  233. CPPUNIT_ASSERT_EQUAL( 4, static_cast<int>(result->getPixel(x,y,i)));
  234. else
  235. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y,i)));
  236. src.set(8,8,8);
  237. result = And(srcAnd, src);
  238. for(int y=0; y<srcAnd.height(); ++y)
  239. for(int x=0; x<srcAnd.width(); ++x)
  240. for(int i=0; i<3; ++i)
  241. if( (y%2==1&&x!=7) || (y%2==0&&x==7) )
  242. CPPUNIT_ASSERT_EQUAL( 8, static_cast<int>(result->getPixel(x,y,i)));
  243. else
  244. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result->getPixel(x,y,i)));
  245. }
  246. }
  247. void TestImageTools::testTreshold()
  248. {
  249. int size = 21;
  250. Image src(size,size);
  251. for(int y=0; y<src.height(); ++y)
  252. for(int x=0; x<src.width(); ++x)
  253. src.setPixelQuick(x,y, x+y);
  254. Image* result = new Image(src.width(), src.height());
  255. // lowerThreshold
  256. {
  257. // with default value
  258. for(int t=0; t<=40; ++t) {
  259. result = lowerThreshold(src, t, result);
  260. for(int y=0; y<src.height(); ++y)
  261. for(int x=0; x<src.width(); ++x)
  262. if(x+y<=t)
  263. CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(result->getPixelQuick(x,y)));
  264. else
  265. CPPUNIT_ASSERT_EQUAL(static_cast<int>(src.getPixelQuick(x,y)),
  266. static_cast<int>(result->getPixelQuick(x,y)));
  267. }
  268. // with another value as the default
  269. for(int t=0; t<=40; ++t) {
  270. result = lowerThreshold(src, t, result, 33);
  271. for(int y=0; y<src.height(); ++y)
  272. for(int x=0; x<src.width(); ++x)
  273. if(x+y<=t)
  274. CPPUNIT_ASSERT_EQUAL(33, static_cast<int>(result->getPixelQuick(x,y)));
  275. else
  276. CPPUNIT_ASSERT_EQUAL(static_cast<int>(src.getPixelQuick(x,y)),
  277. static_cast<int>(result->getPixelQuick(x,y)));
  278. }
  279. }
  280. // upperThreshold
  281. {
  282. for(int t=0; t<=40; ++t) {
  283. result = upperThreshold(src, t, result);
  284. for(int y=0; y<src.height(); ++y)
  285. for(int x=0; x<src.width(); ++x)
  286. if(x+y>t)
  287. CPPUNIT_ASSERT_EQUAL(255, static_cast<int>(result->getPixelQuick(x,y)));
  288. else
  289. CPPUNIT_ASSERT_EQUAL(static_cast<int>(src.getPixelQuick(x,y)),
  290. static_cast<int>(result->getPixelQuick(x,y)));
  291. }
  292. // with another value as the default
  293. for(int t=0; t<=40; ++t) {
  294. result = upperThreshold(src, t, result, 33);
  295. for(int y=0; y<src.height(); ++y)
  296. for(int x=0; x<src.width(); ++x)
  297. if(x+y>t)
  298. CPPUNIT_ASSERT_EQUAL(33, static_cast<int>(result->getPixelQuick(x,y)));
  299. else
  300. CPPUNIT_ASSERT_EQUAL(static_cast<int>(src.getPixelQuick(x,y)),
  301. static_cast<int>(result->getPixelQuick(x,y)));
  302. }
  303. }
  304. // threshold
  305. {
  306. for(int t=0; t<=40; ++t) {
  307. result = threshold(src, t, result);
  308. for(int y=0; y<src.height(); ++y)
  309. for(int x=0; x<src.width(); ++x)
  310. if(x+y<=t)
  311. CPPUNIT_ASSERT_EQUAL(0 , static_cast<int>(result->getPixelQuick(x,y)));
  312. else
  313. CPPUNIT_ASSERT_EQUAL(255, static_cast<int>(result->getPixelQuick(x,y)));
  314. }
  315. }
  316. // lowerThresholdIP
  317. {
  318. Image r(src.width(), src.height());
  319. for(int t=0; t<=40; ++t) {
  320. result = lowerThreshold(src, t, result);
  321. r = Image(src);
  322. lowerThresholdIP(r, t);
  323. for(int y=0; y<src.height(); ++y)
  324. for(int x=0; x<src.width(); ++x)
  325. CPPUNIT_ASSERT_EQUAL(static_cast<int>(result->getPixelQuick(x,y)),
  326. static_cast<int>(r.getPixelQuick(x,y)));
  327. }
  328. // with another value as the default
  329. for(int t=0; t<=40; ++t) {
  330. result = lowerThreshold(src, t, result, 33);
  331. r = Image(src);
  332. lowerThresholdIP(r, t, 33);
  333. for(int y=0; y<src.height(); ++y)
  334. for(int x=0; x<src.width(); ++x)
  335. CPPUNIT_ASSERT_EQUAL(static_cast<int>(result->getPixelQuick(x,y)),
  336. static_cast<int>(r.getPixelQuick(x,y)));
  337. }
  338. }
  339. // upperThresholdIP
  340. {
  341. Image r(src.width(), src.height());
  342. for(int t=0; t<=40; ++t) {
  343. result = upperThreshold(src, t, result);
  344. r = Image(src);
  345. upperThresholdIP(r, t);
  346. for(int y=0; y<src.height(); ++y)
  347. for(int x=0; x<src.width(); ++x)
  348. CPPUNIT_ASSERT_EQUAL(static_cast<int>(result->getPixelQuick(x,y)),
  349. static_cast<int>(r.getPixelQuick(x,y)));
  350. }
  351. // with another value as the default
  352. for(int t=0; t<=40; ++t) {
  353. result = upperThreshold(src, t, result, 33);
  354. r = Image(src);
  355. upperThresholdIP(r, t, 33);
  356. for(int y=0; y<src.height(); ++y)
  357. for(int x=0; x<src.width(); ++x)
  358. CPPUNIT_ASSERT_EQUAL(static_cast<int>(result->getPixelQuick(x,y)),
  359. static_cast<int>(r.getPixelQuick(x,y)));
  360. }
  361. }
  362. // thresholdIP
  363. {
  364. Image r(src.width(), src.height());
  365. for(int t=0; t<=40; ++t) {
  366. result = threshold(src, t, result);
  367. r = Image(src);
  368. thresholdIP(r, t);
  369. for(int y=0; y<src.height(); ++y)
  370. for(int x=0; x<src.width(); ++x)
  371. CPPUNIT_ASSERT_EQUAL(static_cast<int>(result->getPixelQuick(x,y)),
  372. static_cast<int>(r.getPixelQuick(x,y)));
  373. }
  374. }
  375. }
  376. void TestImageTools::testHough()
  377. {
  378. }
  379. void TestImageTools::testKLT()
  380. {
  381. /*
  382. // test exceptions
  383. {
  384. Image src(13,13);
  385. GrayImage16s* gradX = new GrayImage16s(5,6);
  386. GrayImage16s* gradY = NULL;
  387. CPPUNIT_ASSERT_THROW(KLTCornerDetector(src, 4, 10000, 1, 2, gradX, gradY), ImageException);
  388. gradX = NULL;
  389. gradY = new GrayImage16s(5,2);
  390. CPPUNIT_ASSERT_THROW(KLTCornerDetector(src, 4, 10000, 1, 2, gradX, gradY), ImageException);
  391. gradX = NULL;
  392. gradY = NULL;
  393. CPPUNIT_ASSERT_NO_THROW(KLTCornerDetector(src, 4, 10000, 1, 2, gradX, gradY));
  394. gradX = new GrayImage16s(13,13);
  395. gradY = new GrayImage16s(13,13);
  396. CPPUNIT_ASSERT_NO_THROW(KLTCornerDetector(src, 4, 10000, 1, 2, gradX, gradY));
  397. }
  398. // test a simple rectangle
  399. {
  400. Image src(13,13);
  401. src.set(0);
  402. for(int y=4; y<9; ++y)
  403. for(int x=4; x<9; ++x)
  404. src.setPixelQuick(x,y,255);
  405. GrayImage16s* gradX = sobelX(src);
  406. GrayImage16s* gradY = sobelY(src);
  407. Matrix* corners = KLTCornerDetector(src, 4, 1000, 1, 1, gradX, gradY);
  408. CPPUNIT_ASSERT_EQUAL(4, static_cast<int>(corners->rows()));
  409. Image result(src.width(), src.height());
  410. result.set(0);
  411. for(uint i=0; i<corners->rows(); ++i) {
  412. result.setPixelQuick((*corners)(i,0), (*corners)(i,1), 255);
  413. }
  414. for(int y=0; y<result.height(); ++y)
  415. for(int x=0; x<result.width(); ++x)
  416. if(x==4&&(y==4||y==8) || x==8&&(y==4||y==8))
  417. CPPUNIT_ASSERT_EQUAL(255, static_cast<int>(result.getPixelQuick(x,y)));
  418. else
  419. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result.getPixelQuick(x,y)));
  420. }
  421. // test a star structure
  422. {
  423. Image src(23,23);
  424. src.set(0);
  425. for(int y=4; y<=18; ++y)
  426. for(int x=9; x<=13; ++x)
  427. src.setPixelQuick(x,y, 255);
  428. for(int y=9; y<=13; ++y)
  429. for(int x=4; x<=18; ++x)
  430. src.setPixelQuick(x,y, 255);
  431. // soNeighborhood = 1
  432. Matrix* corners = KLTCornerDetector(src, 12, 10000, 1, 1);
  433. CPPUNIT_ASSERT_EQUAL(12, static_cast<int>(corners->rows()));
  434. Image result(src.width(), src.height());
  435. result.set(0);
  436. for(uint i=0; i<corners->rows(); ++i)
  437. result.setPixelQuick((*corners)(i,0), (*corners)(i,1), 255);
  438. for(int y=1; y<result.height()-1; ++y)
  439. for(int x=1; x<result.width()-1; ++x)
  440. if( y==4&&(x==9||x==13) || y==8&&(x==8||x==14) || y==9&&(x==4||x==18) ||
  441. y==13&&(x==4||x==18) || y==14&&(x==8||x==14) || y==18&&(x==9||x==13) )
  442. CPPUNIT_ASSERT_EQUAL(255, static_cast<int>(result.getPixelQuick(x,y)));
  443. else
  444. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result.getPixelQuick(x,y)));
  445. // soNeighborhood = 2
  446. corners = KLTCornerDetector(src, 4, 10000, 2, 2);
  447. CPPUNIT_ASSERT_EQUAL(4, static_cast<int>(corners->rows()));
  448. Image result2(src.width(), src.height());
  449. result2.set(0);
  450. for(uint i=0; i<corners->rows(); ++i)
  451. result2.setPixelQuick((*corners)(i,0), (*corners)(i,1), 255);
  452. for(int y=1; y<result2.height()-1; ++y)
  453. for(int x=1; x<result2.width()-1; ++x)
  454. if( x==11&&y==5 || x==17&&y==11 || x==11&&y==17 || x==5&&y==11 )
  455. CPPUNIT_ASSERT_EQUAL(255, static_cast<int>(result2.getPixelQuick(x,y)));
  456. else
  457. CPPUNIT_ASSERT_EQUAL( 0, static_cast<int>(result2.getPixelQuick(x,y)));
  458. }
  459. */
  460. }
  461. #endif // NICE_USELIB_CPPUNIT