diff --git a/src/core/pnm.cpp b/src/core/pnm.cpp index 5b1f138..7c3f724 100644 --- a/src/core/pnm.cpp +++ b/src/core/pnm.cpp @@ -44,7 +44,7 @@ PNM::PNM(int width, int height, QImage::Format format) : { case QImage::Format_Mono: break; - case QImage::Format_Indexed8: + case QImage::Format_Grayscale8: this->setColorCount(256); for (int i = 0; i < 256; i++) diff --git a/src/core/tools.cpp b/src/core/tools.cpp index b45d5bb..82d624e 100644 --- a/src/core/tools.cpp +++ b/src/core/tools.cpp @@ -21,7 +21,7 @@ void Tools::negativeImage() ImageViewer* iv = getViewer(); // Get the ImageViewer which holds the image. if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -45,7 +45,7 @@ void Tools::correctBrightnessContrastGamma() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -75,7 +75,7 @@ void Tools::histogramEqualize() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -87,7 +87,7 @@ void Tools::histogramStretch() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -113,7 +113,7 @@ void Tools::blurGauss() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -132,7 +132,7 @@ void Tools::blurLinear() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -152,7 +152,7 @@ void Tools::blurUniform() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -170,7 +170,7 @@ void Tools::binGradient() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -182,7 +182,7 @@ void Tools::binIterBimodal() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -194,7 +194,7 @@ void Tools::binManual() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -216,7 +216,7 @@ void Tools::binNiblack() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -234,7 +234,7 @@ void Tools::binOtsu() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -252,7 +252,7 @@ void Tools::noiseMedian() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -269,7 +269,7 @@ void Tools::noiseBilateral() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -294,7 +294,7 @@ void Tools::morphDilate() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -316,7 +316,7 @@ void Tools::morphErode() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -338,7 +338,7 @@ void Tools::morphOpen() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -360,7 +360,7 @@ void Tools::morphClose() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -387,7 +387,7 @@ void Tools::edgeSobel() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -399,7 +399,7 @@ void Tools::edgePrewitt() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -411,7 +411,7 @@ void Tools::edgeRoberts() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -424,7 +424,7 @@ void Tools::edgeLaplacian() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -444,7 +444,7 @@ void Tools::edgeZero() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -470,7 +470,7 @@ void Tools::mapHeight() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -483,7 +483,7 @@ void Tools::mapHorizon() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -524,7 +524,7 @@ void Tools::edgeCanny() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -549,7 +549,7 @@ void Tools::houghTransform() ImageViewer* iv = getViewer(); if (!SupportedImageFormat(iv, QList() << QImage::Format_Mono - << QImage::Format_Indexed8 + << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -590,7 +590,7 @@ void Tools::cornerHarris() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; @@ -633,7 +633,7 @@ void Tools::segmentation() { ImageViewer* iv = getViewer(); - if (!SupportedImageFormat(iv, QList() << QImage::Format_Indexed8 + if (!SupportedImageFormat(iv, QList() << QImage::Format_Grayscale8 << QImage::Format_RGB32)) return; diff --git a/src/core/transformations/conversion_grayscale.cpp b/src/core/transformations/conversion_grayscale.cpp index 34dc613..7cc66cb 100644 --- a/src/core/transformations/conversion_grayscale.cpp +++ b/src/core/transformations/conversion_grayscale.cpp @@ -17,7 +17,7 @@ PNM* ConversionGrayscale::transform() int width = image->width(); int height = image->height(); - PNM* newImage = new PNM(width, height, QImage::Format_Indexed8); + PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8); if (image->format() == QImage::Format_Mono) { diff --git a/src/core/transformations/edge_canny.cpp b/src/core/transformations/edge_canny.cpp index 2c9695a..b52129f 100644 --- a/src/core/transformations/edge_canny.cpp +++ b/src/core/transformations/edge_canny.cpp @@ -22,7 +22,7 @@ PNM* EdgeCanny::transform() int upper_thresh = getParameter("upper_threshold").toInt(), lower_thresh = getParameter("lower_threshold").toInt(); - PNM* newImage = new PNM(width, height, QImage::Format_Indexed8); + PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8); qDebug() << Q_FUNC_INFO << "Not implemented yet!"; diff --git a/src/core/transformations/edge_zero.cpp b/src/core/transformations/edge_zero.cpp index f74d68f..541943f 100644 --- a/src/core/transformations/edge_zero.cpp +++ b/src/core/transformations/edge_zero.cpp @@ -21,7 +21,7 @@ PNM* EdgeZeroCrossing::transform() double sigma = getParameter("sigma").toDouble(); int t = getParameter("threshold").toInt(); - PNM* newImage = new PNM(width, height, QImage::Format_Indexed8); + PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8); qDebug() << Q_FUNC_INFO << "Not implemented yet!"; diff --git a/src/core/transformations/map_height.cpp b/src/core/transformations/map_height.cpp index f8b1413..71687d3 100644 --- a/src/core/transformations/map_height.cpp +++ b/src/core/transformations/map_height.cpp @@ -15,7 +15,7 @@ PNM* MapHeight::transform() int width = image->width(), height = image->height(); - PNM* newImage = new PNM(width, height, QImage::Format_Indexed8); + PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8); qDebug() << Q_FUNC_INFO << "Not implemented yet!"; diff --git a/src/core/transformations/map_horizon.cpp b/src/core/transformations/map_horizon.cpp index 80b2cb3..ebcef32 100644 --- a/src/core/transformations/map_horizon.cpp +++ b/src/core/transformations/map_horizon.cpp @@ -33,7 +33,7 @@ PNM* MapHorizon::transform() dy = -1; } - PNM* newImage = new PNM(width, height, QImage::Format_Indexed8); + PNM* newImage = new PNM(width, height, QImage::Format_Grayscale8); qDebug() << Q_FUNC_INFO << "Not implemented yet!"; diff --git a/src/core/transformations/negative_image.cpp b/src/core/transformations/negative_image.cpp index 01c4e53..bc948df 100644 --- a/src/core/transformations/negative_image.cpp +++ b/src/core/transformations/negative_image.cpp @@ -33,9 +33,8 @@ PNM* NegativeImage::transform() newImage->setPixel(x,y, color == Qt::white ? Qt::color0 : Qt::color1); } } - else if (image->format() == QImage::Format_Indexed8) + else if (image->format() == QImage::Format_Grayscale8) // Iterate over image space { - // Iterate over image space for (int x=0; xsetPixel(x,y, v); + newImage->setPixel(x,y, QColor(v,v,v).rgb()); } } else //if (image->format() == QImage::Format_RGB32) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 2cd4a18..9ad3244 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -135,7 +135,7 @@ QString MainWindow::textFormat(QImage::Format format) { if (format == QImage::Format_RGB32) return "Color RGB 32-bit"; - else if (format == QImage::Format_Indexed8) + else if (format == QImage::Format_Grayscale8) return "Grayscale 8-bit"; else if (format == QImage::Format_Mono) return "Black & white 1-bit"; diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 9d93d59..b11ee7c 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -2,7 +2,7 @@ #define MAINWINDOW_H #define PROGRAM_NAME "PTO" -#define PROGRAM_VER "3.1.3.37" +#define PROGRAM_VER "3.1.3.38" #define DEFAULT_IMG "lenna_512x512.pnm" #include