void IntensityImageStudent::set(const IntensityImageStudent &other) { IntensityImage::set(other.getWidth(), other.getHeight()); delete[] pixel_storage; this->pixel_storage = new Intensity[getWidth() * getHeight()]; int max = getHeight() * getWidth(); for (int i = 0; i < max; ++i) { pixel_storage[i] = other.pixel_storage[i]; } }
void IntensityImageStudent::set(const IntensityImageStudent &other) { const int SIZE = other.getSize(); IntensityImage::set(other.getWidth(), other.getHeight()); if (SIZE > 0) { delete[] pixelMap; pixelMap = new Intensity[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
IntensityImageStudent GaussianFilter::applyFilter(const IntensityImage &image) { IntensityImageStudent filteredImage = IntensityImageStudent(image.getWidth() - 2 * radius, image.getHeight() - 2 * radius); for (int y = 0; y < filteredImage.getHeight(); y++){ for (int x = 0; x < filteredImage.getWidth(); x++){ double filteredIntensity = 0.0; for (unsigned int i = 0; i < gaussKernel.size(); i++){ filteredIntensity += gaussKernel[i] * image.getPixel(x + (i % (2 * radius + 1)), y + i / (2 * radius + 1)); } filteredImage.setPixel(x, y, static_cast<Intensity>(filteredIntensity)); } } return filteredImage; }
IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other) : IntensityImage(other.getWidth(), other.getHeight()) { init_intensity_image(); for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ intensity_image[x][y] = other.getPixel(x, y); } } }
IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other) : IntensityImage(other.getWidth(), other.getHeight()), pixelMap(nullptr) { const int SIZE = other.getSize(); if (SIZE > 0) { pixelMap = new Intensity[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other) : IntensityImage(other.getWidth(), other.getHeight()), pixel_storage(new Intensity[other.getWidth() * other.getHeight()]) { int max = other.getHeight() * other.getWidth(); for (int i = 0; i < max; ++i) { pixel_storage[i] = other.pixel_storage[i]; } }