Skip to content
Snippets Groups Projects
Commit 2e425629 authored by theazgra's avatar theazgra
Browse files

Destructor print.

parent 1ce1986d
No related branches found
No related tags found
No related merge requests found
...@@ -142,6 +142,7 @@ ImageMatrix::ImageMatrix(const uint width, const uint height, const PixelType pi ...@@ -142,6 +142,7 @@ ImageMatrix::ImageMatrix(const uint width, const uint height, const PixelType pi
ImageMatrix::~ImageMatrix() ImageMatrix::~ImageMatrix()
{ {
printf("ImageMatrix destructor...\n");
for (size_t i = 0; i < data.size(); i++) for (size_t i = 0; i < data.size(); i++)
{ {
if (data[i]) if (data[i])
...@@ -226,13 +227,13 @@ void ImageMatrix::save_as_ppm(std::string baseFileName) const ...@@ -226,13 +227,13 @@ void ImageMatrix::save_as_ppm(std::string baseFileName) const
void ImageMatrix::fill(BasePixel *px) void ImageMatrix::fill(BasePixel *px)
{ {
for(size_t i = 0; i < data.size(); i++) for (size_t i = 0; i < data.size(); i++)
data[i] = px; data[i] = px;
} }
ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other) ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other)
{ {
always_assert(rowCount == other.rows() && colCount == other.cols() && pixelType() == other.pixel_type()); always_assert(rowCount == other.rows() && colCount == other.cols() && pixelType == other.pixel_type());
ImageMatrix diff(colCount, rowCount, PixelType_Gray8); ImageMatrix diff(colCount, rowCount, PixelType_Gray8);
diff.fill(new Gray8Pixel(0)); diff.fill(new Gray8Pixel(0));
...@@ -241,7 +242,7 @@ ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other) ...@@ -241,7 +242,7 @@ ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other)
size_t size = this->data.size(); size_t size = this->data.size();
ulong diffCounter = 0; ulong diffCounter = 0;
for(size_t i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
{ {
if (!(this->data[i]->equals(other.get(size)))) if (!(this->data[i]->equals(other.get(size))))
{ {
...@@ -252,6 +253,6 @@ ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other) ...@@ -252,6 +253,6 @@ ImageMatrix ImageMatrix::create_difference_matrix(const ImageMatrix &other)
float differentPercentage = (float)(diffCounter) / (float)(size); float differentPercentage = (float)(diffCounter) / (float)(size);
printf("Difference between images: %f\n", differentPercentage); printf("Difference between images: %f\n", differentPercentage);
return diff; return diff;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment