Solution: Mini Project 1
In this lesson, you will see the solution review of the exercise given in the previous lesson.
We'll cover the following...
Solution #
Press the RUN button and see the output!
Press + to interact
#include "imagelib.h"int main() {// Displays input imageloadFile("input.png");// Traverse rows in 2D arrayfor (int i = 0; i < height; i++) {// Traverse columns in each rowfor (int j = 0; j < width; j++) {// Process pixel image[i][j], hereif (image[i][j] <= 70) {// Sets image pixel to blackimage[i][j] = 0;} else {// Sets image pixel to whiteimage[i][j] = 255;}}}// Displays modified imagesaveFile("output/modified.png");}
📝Note: In the above code widget, you can see the modified image by pressing the arrow button
>
towards the right of ...