void ScreenBuffer::draw(void) { glClear(GL_COLOR_BUFFER_BIT); for (int x = 0; x < getWidth(); x ++) { for (int y = 0; y < getHeight(); y ++) { if (getPixelIntensity(x, y) != 0.0) { drawPixel(x, y, getPixelIntensity(x, y)); } } } glFlush(); glutSwapBuffers(); }
IntensityImage * StudentPreProcessing::stepToIntensityImage(const RGBImage &image) const { const int width = image.getWidth(); const int height = image.getHeight(); auto & output = *ImageFactory::newIntensityImage(width, height); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { RGB rgb = image.getPixel(x, y); output.setPixel(x, y, getPixelIntensity(rgb)); } } return &output; }