mirror of
https://github.com/andre-wojtowicz/image-processing-project-student.git
synced 2024-11-26 14:50:28 +01:00
1 line
7.1 KiB
JSON
1 line
7.1 KiB
JSON
{"name":"Mini-GIMP template project for Image processing course","tagline":"","body":"This program is a student template of a project for **Image processing** course. During 15 laboratories the students have to program a mini-GIMP application.\r\n\r\nThe code is written in C++ which uses [Qt](https://www.qt.io) library; tested 5.1.1 version, should compile and run on Windows (MinGW or MSVC), Linux and MacOS. The code may be completed in Qt Creator or Visual Studio. The program works with all [Netpbm](http://en.wikipedia.org/wiki/Portable_anymap) files as well as JPEG, PNG, etc.\r\n\r\nThe program has the following image processing procedures to be completed:\r\n\r\n1. negative (already done as an example),\r\n2. grayscale conversion,\r\n3. correction (brightness, contrast and gamma),\r\n4. histogram (construction, stretching and equalizing),\r\n5. convolution (with custom filter),\r\n6. blurring (uniform and Gaussian),\r\n7. binarization (manual, gradient, iterative bimodal, Otsu and Niblack),\r\n8. noise reduction (median and bilateral),\r\n9. morphology (structural elements, dilation, erosion, opening and closing),\r\n10. edge detection (Roberts, Prewitt, Sobel, Laplacian with zero-crossing and Canny),\r\n11. procedural textures (height map, normal mapping, horizon mapping and Perlin noise),\r\n12. lines and rectangles detection (Hough),\r\n13. corners detection (Harris),\r\n14. segmentation (watershed).\r\n\r\n**The completed version of the project is stored on the different private repository**. It is stored for lecturer's as a helpfull tool to assess students' solutions. If you need it, please send me an e-mail.\r\n\r\n# Screenshots\r\n\r\nThe following screenshots regards to completed version of the program:\r\n\r\n![](screen1.png)\r\n\r\n![](screen2.png)\r\n\r\n![](screen3.png)\r\n\r\n# Documentation\r\n\r\nThe project consists of 3 folders:\r\n* **images** - contains images saved in `pnm` format,\r\n* **res** - here are icons for the program,\r\n* **src** - main sources.\r\n \r\nIn sources you can find two modules:\r\n* **core** - files concering loading and saving images and transofmations,\r\n* **gui** - everything related to a graphic user interface.\r\n \r\nWriting solutions means completing the `.cpp` files in a directory `src/core/transformations/` and a file `src/core/histogram.cpp`. \r\n\r\nA hint that something needs to be implement is:\r\n\r\n```cpp\r\nqDebug() << Q_FUNC_INFO << \"Not implemented yet!\";\r\n```\r\n\r\n## Debugging\r\n\r\nIf you like debugging by printing values of variables you just need to use `qDebug()` in the following way:\r\n\r\n```cpp\r\nqDebug() << \"width =\" << image->width();\r\n```\r\n\r\n## PNM class\r\n\r\nMain class to handle an image is **PNM** which inherits [QImage](http://qt-project.org/doc/qt-5.1/qtgui/qimage.html). Main methods are:\r\n * **pixel(...)** - getting a value of a given pixel of an image,\r\n * **setPixel(...)** - saving in the image given value of a pixel,\r\n * **format()** - getting a format of the image.\r\n \r\nWe are interested only in three formats of images:\r\n * **QImage::Format_Mono** - black and white,\r\n * **QImage::Format_Indexed8** - grayscale,\r\n * **QImage::Format_RGB32** - 3-channels color.\r\n \r\nTo get a value of a pixel from a desired channel some functions from [QColor](http://qt-project.org/doc/qt-5.1/qtgui/qcolor.html) will be helpful:\r\n * **qRed(...)**,\r\n * **qGreen(...)**,\r\n * **qBlue(...)**,\r\n * **qGray(...)**.\r\n \r\nAn example is in `src/core/transformations/negative_image.cpp`\r\n\r\n## Automatic loading of an image\r\n\r\nIf you setup a working directory on a folder `images` then when you run the program you should see on the screen `lenna_512x512.pnm`.\r\n\r\nMore information you will find at the top of `src/gui/mainwindow.h`.\r\n\r\nDuring compilation you might find useful automatic launching of a transformation.\r\n \r\n## Signals\r\n\r\nSome of next transformations may perform a bit longer so it will be OK to display some auxiliary messages. You may achieve it by so-called signals:\r\n * **message(QString)**,\r\n * **progress(int)**.\r\n \r\nExample:\r\n```cpp\r\nemit message(\"Edge detection...\");\r\n```\r\n\r\nor\r\n\r\n```cpp\r\nemit progress(100*x/double(image->width()));\r\n```\r\n\r\n## Mixing transformations\r\n\r\nSome of transformations need using others. In transformations you must use `transform()` method, i.e.:\r\n\r\n```cpp\r\nPNM* grayImage = ConversionGrayscale(image).transform();\r\n```\r\n\r\nMost of the transformations use parameters (constants, sigmas, regions etc.). It's done by methods:\r\n * **setParameter(...)**,\r\n * **getParameter(...)**.\r\n \r\nAn exemplar use is in a file `src/core/tools.cpp` or `src/core/transformations/edge_canny.cpp`\r\n\r\nIn order to display messages or progress of used transformation you must put in its construction an instance of `ImageViewer`, i.e.:\r\n\r\n```cpp\r\nemit message(\"Blurring...\");\r\n\r\nBlurGaussian blurTrans(grayImage, getSupervisor());\r\nblurTrans.setParameter(\"size\", 3);\r\nblurTrans.setParameter(\"sigma\", 1.6);\r\n\r\nPNM* blurredImage = blurTrans.transform();\r\n```\r\n\r\nPlease remember to delete redundant variables before you return a result, i.e.:\r\n\r\n```cpp\r\ndelete grayImage;\r\n\r\nreturn newImage;\r\n```\r\n\r\n## Possible performance increase\r\n\r\n * resign from `src/core/matrix.h` and work directly on arrays,\r\n * avoid `QImage::pixel(...)` and `QImage::setPixel(...)` and work directly on arrays given by `QImage::bits()`\r\n\r\n\r\n# Programming in Visual Studio 2012 with Image Watch extenstion\r\n\r\nThere is [Visual Studio Add-in](https://download.qt.io/official_releases/vsaddin/) for Qt5 so you don't have to use Qt Creator and what's more, debugging is far easier and faster.\r\n\r\nMicrosoft released [Image Watch](https://visualstudiogallery.msdn.microsoft.com/e682d542-7ef3-402c-b857-bbfba714f78d) extension which allows to display an image during debugging.\r\n\r\n1. import the project (`QT5 > Open Qt Project File (.pro)...`),\r\n1. open `pnm.h` file and uncomment lines 11-13,\r\n1. add to your project a path to a directory with private Qt headers (in _Solution Explorer_ `Properties > Configuration Properties > C/C++ > General > Additional Include Directories`):\r\n * this can be for example `C:\\software\\qt\\5.1.1\\msvc2012\\include\\QtGui\\5.1.1`. \r\n1. to your directory `Documents\\Visual Studio 2012\\Visualizers` copy `src\\core\\pnm.natvis`,\r\n1. install **Image Watch** extension (`Tools > Extensions and Updates...` and in _Online_ search _Image Watch_).\r\n\r\nEffects you can check on the negative operation. During debugging you have to display _Image Watch_ window (`View > Other Windows > Image Watch`) and when the debugger reaches breakpoints you can watch any PNM-type variable (with the exception of binary images! but you can handle this by conversion to a grayscale). When you click on a variable you must also tick _4-Channel Ignore Alpha_.\r\n\r\n![Image Watch example](image-watch.png)\r\n\r\n# Credits\r\nCo-author of the project is [Krzysztof Szarzyński](http://quati.pl). ","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} |