This project is an introduction to image manipulation using the graphical user interface (GUI) library, Qt4. Many professional software programs, including Maya, design and create their GUIs using Qt, and it runs on many OSs (macOS, Linux, Windows, mobile OSs, embedded systems).
For this project, you will use Qt4's QImage and QColor classes to load an image and save out several new images edited pixel by pixel. Although the Qt code is in C++, you will apply what you have learned in C.
Implement three functions that edit the pixels retrieved from given images:
• One that creates and saves a new image composed of stripes of at least two colors.
• One that creates and saves a new image with colors of the given image inverted.
• One that creates and saves a new image that combines two given images based on an extracted alpha value (the transparency).
Besides, write one additional function:
• Firstly, write a function to create and save a grayscale monochrome version of the given image.
• Next, add parameter options to this monochrome function for customizing the color tone of the monochrome rather than having only grayscale (i.e. using just the red, green, or blue channels or customizing further with a given color like a purple or sepia tone).
See the image sample below for an idea about what you should achieve. Use the provided PNG files, which are of the same size. PNGs store an alpha channel for transparency.
The only Qt functions you are allowed to use are:
• From QImage: pixel(), setPixel(), width(), height(), save()
• From QColor: setRgb(), rgba(), red(), green(), blue(), alpha(), setRed(), setGreen(), setBlue(), setAlpha(), setRgb()
• Provided is a compressed file containing a folder structured by CLion (based on CMake) of:
1) main.cpp (a C++ source-code file which is all code for the project)
2) CompilingNotes.txt (notes on compiling and running particularly concerning how to use CMakeLists.txt)
3) Images (Shia & fluff.png) (a folder containing the images to read and is where new ones will be saved)
• Create a new CLion project as a C++ executable, and copy these 3 provided files into your project folder.
• When you run the code, make sure you have the main project folder selected in the project view within CLion.
The path for reading and saving images relies on your current working directory.
• After building and running main.cpp, Shia should appear in a window, and a new file (yellow.png) should be saved under Images.
• main.cpp contains 3 functions to help you get started with coding:
1) getRgbaPixel() which reads all four color channels (RGBA) of a pixel in the given image.
2) makeYellowImage() which generates an all-yellow image of the same size as the given image and shows how to iterate by rows and columns.
3) main() which reads the input images, calls the other functions, and displays the image(s).
Submit a compressed file named LastnameFirstname with ONLY main.cpp and the Images folder containing all of the produced images.
This assignment has been answered 3 times in private sessions.
© 2022 Codify Tutor. All rights reserved