Skip to main content
Version: Next

C & C++ Example Apps

Purpose

These demo applications demonstrate how to use the Img2Num library for image processing and test that the library works as expected. Both a C and a C++ version are provided for flexibility.

Overview

Both applications demonstrate how to process an image using the Img2Num library.

Setup

Prerequisites and Build Instructions

See the Setup & Dependencies page in the Contributing section.

note

If you have already set up the project, you will only need to run the below to build these apps:

cmake -S . --build build

Usage

important

The application needs to be compiled beforehand, so make sure to follow the instructions in the Setup & Dependencies page. Once built, you can run the applications as shown below.

Run this from the root of the project
./console_cpp_app <image_file>
Example usage
./build/example-apps/console-cpp/console_cpp_app test.jpg

Expected Output: console-cpp-output.png in the root of the project.

Explanation of Key Parts

Common Points for Both Applications

Dependencies

  • stb_image
  • stb_image_write
  • Img2Num
  • CImg2Num (only for the C app)
info

The stb dependencies are configured in the root CMakeLists.txt as a submodule.

Testing

Both applications can be used to test Img2Num’s functionality by verifying that the image is loaded, blurred, and saved correctly.

Conclusion

Both the C and C++ versions of this demo app serve the same purpose. Choose the version that fits best with the project's language standards or personal preference. These apps are intended to test Img2Num's core functionality and serve as examples for more complex projects.