BRL-CAD (Org ID 4884012200361984) Task ID 5742049970618368 | Task Definition ID 5649945713967104 Max instances: 1 Title: Implement a small utility in C/C++ that counts the colors in an image Description: The goal of this task is to implement an application that reads in an image file and reports back a count for all unique RGB colors. In fact, there's a tool in BRL-CAD that does exactly this already. If you have BRL-CAD compiled, you can run pixcount from the build directory: ``` bin/pixcount share/pix/moss.pix 0 0 1 149586 0 1 0 1 1 1 0 2 1 2 1 4 1 3 1 3 ... ``` The first three numbers are the R G B values, the fourth number is the count. You can find the source code to that tool in a BRL-CAD's source checkout at src/util/pixcount.cpp and that's what we want you to implement in C/C++. I'm sure you're wondering, why?? It's because that small 200-line tool's implementation uses a red-black tree container that we'd like to get rid of. Before we can get rid of it, we need to rewrite tools like pixcount to not use it. In terms of re-writing pixcount, the easiest possibility if you know C++ is probably to use a std::map with an RGBA value as an int32_t index. You're welcome to use the existing code as a base, particularly for argument handling and reading .pix file data into memory. If you edit the file directly, you'll be able to run "svn diff > yourfile.patch" to create a file that we can easily review and test (see https://brlcad.org/wiki/Patches). **SUBMIT** a rewrite of pixcount in C or C++ that preserves the same usage and output behavior without using the bu_rb interface. Tags: pixel data, computer graphics, image processing, c/c++ Categories: Coding Is Beginner: No Time given to complete: 3 days Mentors: brlcad@gmail.com, DanielMRossberg@gmail.com, dubenko.oleksandr@gmail.com Student: Jebbly (ID 6044361150693376) Status: COMPLETED (2019-12-08 17:46:24) Last modified: 2019-12-05 20:57:14