| .gitignore | ||
| catch.hpp | ||
| ConnectedComponent.cpp | ||
| ConnectedComponent.h | ||
| findcomp.cpp | ||
| Makefile | ||
| PGMimageProcessor.cpp | ||
| PGMimageProcessor.h | ||
| README.md | ||
| testfindcomp.cpp | ||
BLLCHA013 A program that takes an input image and finds connected components
BLLCHA013 A program that takes an input image and finds connected components
Usage instructions:
A Makefile is included. A compatible C++ compiler is required, such as GCC g++ or LLVM/clang clang++ supporting the C++14 standard. The Makefile assumes g++.
To compile this software, run make in this directory. The software must be compiled in order to run. To run, execute the findcomp executable with appropriate command line arguments (findcomp [options] ) Example from this directory: ./findcomp -w output.pgm chess.pgm
To perform unit tests, run "make test" in this directory and execute the "testfindcomp" executable. Example from this directory: ./testfindcomp Note: for units tests to run, the file "chess.pgm" must exist. It has been provided. Unit test values have been set to values expected after processing the provided PGM file.
Command line arguments:
findcomp [options] <inputPGM/PPMfile>
where is a valid PGM P5 or PPM P6 image and valid options are: -s (-s min max) - set the min/max valid component size [default min=3, max="unlimited"] -t - set threshold for component detection [default 128, must be between 0 and 255] -p - print out all component data and some additional information -w <outPGM/PPMfile> - write out retained components (thresholded image) to a new PGM/PPM file -b - write out PPM image with bounding boxes drawn over it showing where retained component locations
Note that the program will automatically determine whether a P5 or P6 input image was provided. Please match the output file (-w) extenstion accordingly. The -b argument should always be provided with a .ppm extension.
Here's a full example to exercise the program: ./findcomp -t 180 -s 3 153468 -p -w output.pgm -b bounds.ppm chess.pgm
Source file explanation:
PGMimageProcessor.h and ConnectedComponent.h are the header files containing declarations of methods and classes required in other files.
PGMimageProcessor.cpp and ConnectedComponent.cpp are the implementation files, containing the methods needed to execute the program logic. They contain the bulk of the program logic.
findcomp.cpp is the driver file, containing the main() method. It calls into methods defined in PGMimageProcessor.cpp which perform the bulk of the program logic.
catch.hpp is the Catch unit testing framework, allowing for easier unit testing of code.
testfindcomp.cpp is the unit testing driver file, containing unit tests for multiple methods. It tests the correctness of the program logic.