/easyeye/tests/ImagingTest.cc

https://gitlab.com/biometricscurious/easyeye · C++ · 63 lines · 27 code · 10 blank · 26 comment · 0 complexity · 678cbbfb4b6ae080ac64fb423d339405 MD5 · raw file

  1. /*
  2. * File: ImagingTest.cc
  3. * Author: mchaberski
  4. *
  5. * Created on Jan 27, 2014, 1:21:34 PM
  6. */
  7. #include <iostream>
  8. #include "ImagingTest.h"
  9. #include <opencv2/core/core.hpp>
  10. #include <opencv2/highgui/highgui.hpp>
  11. #include "../src/easyeye/common/easyeye_imaging.h"
  12. using namespace std;
  13. using namespace easyeye;
  14. using namespace cv;
  15. CPPUNIT_TEST_SUITE_REGISTRATION(ImagingTest);
  16. ImagingTest::ImagingTest() {
  17. }
  18. ImagingTest::~ImagingTest() {
  19. }
  20. void ImagingTest::setUp() {
  21. }
  22. void ImagingTest::tearDown() {
  23. }
  24. void Describe(ostream& out, string name, IplImage* image)
  25. {
  26. out << name << ' ' << image->width << 'x' << image->height << endl;
  27. }
  28. void Describe(ostream& out, string name, Mat& image)
  29. {
  30. out << name << ' ' << image.cols << 'x' << image.rows << " continuous = " << image.isContinuous() << "; submatrix = " << image.isSubmatrix() << endl;
  31. }
  32. void ImagingTest::testGetROI() {
  33. /**
  34. * This test is obsolete now that we removed ImageUtility.h
  35. */
  36. // IplImage* ipl = cvLoadImage("../testdata/images/green-rectangle.png", CV_LOAD_IMAGE_GRAYSCALE);
  37. // Mat mat = cv::imread("../testdata/images/green-rectangle.png", CV_LOAD_IMAGE_GRAYSCALE);
  38. //
  39. // Describe(cerr, "ipl", ipl);
  40. // Describe(cerr, "mat", mat);
  41. //
  42. // IplImage* ipl_roi = ImageUtility::getROIImage(ipl, 100, 150, 100, 150);
  43. // Mat mat_roi = Imaging::GetROI(mat, 100, 150, 100, 150);
  44. //
  45. // Describe(cerr, "ipl_roi", ipl_roi);
  46. // Describe(cerr, "mat_roi", mat_roi);
  47. //
  48. // CPPUNIT_ASSERT_EQUAL(ipl_roi->width, mat_roi.cols);
  49. // CPPUNIT_ASSERT_EQUAL(ipl_roi->height, mat_roi.rows);
  50. //
  51. // cvReleaseImage(&ipl);
  52. // cvReleaseImage(&ipl_roi);
  53. }