{"id":15735649,"url":"https://github.com/vahancho/nkar","last_synced_at":"2025-06-12T21:40:06.230Z","repository":{"id":49785580,"uuid":"126503309","full_name":"vahancho/nkar","owner":"vahancho","description":"Նկար (nkar) image comparison and differences highlighting C++ API ","archived":false,"fork":false,"pushed_at":"2023-12-04T16:20:13.000Z","size":3483,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T11:11:17.350Z","etag":null,"topics":["comparison","contour","contours","cpp","cpp11","difference","diffing","gcc","highlight","highlighting","hightlight","image","image-comparison","image-processing","nkar","pixel","testing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vahancho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-23T15:20:18.000Z","updated_at":"2024-10-27T04:09:15.000Z","dependencies_parsed_at":"2024-10-25T00:18:37.791Z","dependency_job_id":"85c86043-6955-4428-b869-7660698c775c","html_url":"https://github.com/vahancho/nkar","commit_stats":{"total_commits":105,"total_committers":1,"mean_commits":105.0,"dds":0.0,"last_synced_commit":"88b1337f2d9852ed14267196fd81d0b0175667c9"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fnkar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fnkar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fnkar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fnkar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vahancho","download_url":"https://codeload.github.com/vahancho/nkar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243361368,"owners_count":20278556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comparison","contour","contours","cpp","cpp11","difference","diffing","gcc","highlight","highlighting","hightlight","image","image-comparison","image-processing","nkar","pixel","testing"],"created_at":"2024-10-04T01:14:18.251Z","updated_at":"2025-03-13T07:31:54.030Z","avatar_url":"https://github.com/vahancho.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nkar image comparison and differences highlighting C++ API\n\nNkar (Armenian: նկար) is an image processing and comparison utility. The comparison\nof two images of the same size based on comparing each pixel of one image with the\ncorresponding pixel of another one. After all differences are identified, algorithm\ngenerates contours (polygons) that outlines the differences. The API provides both\nerror reporting and differences analysis. For instance results contains information\non the number of difference contours generated (see usage example below).\n\nAccording to [stb single-file public domain libraries](https://github.com/nothings/stb)\nwe use for image loading/decoding/saving the following image formats are supported:\nJPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC.\n\n[![Latest release](https://img.shields.io/github/v/release/vahancho/nkar?include_prereleases)](https://github.com/vahancho/nkar/releases)\n[![Test (CMake)](https://github.com/vahancho/nkar/actions/workflows/cmake.yml/badge.svg)](https://github.com/vahancho/nkar/actions/workflows/cmake.yml)\n[![Build status](https://ci.appveyor.com/api/projects/status/gh9v3ynrm1dt1w7t/branch/master?svg=true)](https://ci.appveyor.com/project/vahancho/nkar/branch/master)\n[![codecov](https://codecov.io/gh/vahancho/nkar/branch/master/graph/badge.svg)](https://codecov.io/gh/vahancho/nkar)\n\n### Installation\n\nNo installation required. Just incorporate header and source files from *src/* directory\nin your project and compile them. Use `nkar::Comparator` class to compare two images.\nAll library classes are in *nkar* namespace.\n\n#### Integration with `CMake` projects\n\nHowever, if you use `CMake` and want to integrate the library into your project\nyou might want to install it first by invoking a `CMake` command from the build directory:\n\n```\ncmake --install . --prefix=\u003cinstall_path\u003e --config=Release\n```\n\nOnce the library is installed you can use it from in your project by adjusting its\n`CMake` script. For example:\n\n```\n[..]\nfind_package(nkar REQUIRED)\n\nadd_executable(example main.cpp)\ntarget_link_libraries(example nkar)\n[..]\n```\n\n### Prerequisites\n\nThere are no special requirements and dependencies except *C++11* compliant compiler.\nFor more details see the CI badges (*GitHub Actions*, *AppVeyor CI* etc.).\n\n### Usage Example:\n\n```cpp\n// A simple application that compares two image files and saves differences in a third one.\n\n#include \u003cstring\u003e\n\n#include \"comparator.h\"\n#include \"image.h\"\n\nusing namespace nkar;\n\nint main(int argc, char **argv)\n{\n  if (argc != 4) {\n    fprintf(stderr, \"Incorrect number of arguments\\n\");\n    return -1;\n  }\n\n  // Compare two image files.\n  auto highlightColor = Color{0, 255, 0}; // The diff outline color.\n  auto result = Comparator::compare(argv[1], argv[2], highlightColor);\n\n  if (result.error() != Result::Error::NoError) {\n    // An error occurred during comparison.\n    fprintf(stderr, \"%s\\n\", result.errorMessage().c_str());\n    return -1;\n  }\n\n  if (result.status() == Result::Status::Different) {\n    if (result.resultImage().save(argv[3])) {\n      fprintf(stdout, \"Images are different: %d contours found. Image with highlighting is saved to '%s'\\n\",\n              result.contourCount(), argv[3]);\n      return -1;\n    } else {\n      fprintf(stderr, \"Failed to save result image\\n\");\n      return -1;\n    }\n  }\n\n  fprintf(stdout, \"Images are identical\\n\");\n  return 0;\n}\n```\n\n### Test\n\nThere are unit tests provided for `nkar::Comparator` class. You can find them in the *test/* directory.\nTo run them you have to build and run the test application. For doing that you must invoke the following\ncommands from the terminal, assuming that compiler and environment are already configured:\n\n##### Linux (gcc)\n\n```\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=True\ncmake --build .\nctest\n```\n\n##### Windows (MSVC Toolchain)\n\n```\nmkdir build \u0026\u0026 cd build\ncmake .. -DENABLE_TESTING=True -A x64\ncmake --build . --config=Release\nctest -C Release\n```\n\nFor x86 builds use `-A Win32` option instead.\n\n### Examples\n\nBelow are some examples of image comparison with results. Third image in each row\nrepresents an image generated by *Comparator* and contains contours (red outlines)\nthat highlight the differences:\n\n| expected | actual | diff with contours |\n| --- | --- | --- |\n| \u003cimg src=\"./test/images/map1.png\" width=\"200\"\u003e | \u003cimg src=\"./test/images/map2.png\" width=\"200\"\u003e | \u003cimg src=\"./test/images/map_result.png\" width=\"200\"\u003e |\n| ![](./test/images/empty.png) | ![](./test/images/13.png) | ![1diff](./test/images/13_result.png) |\n| ![](./test/images/lenna.png) | ![](./test/images/lenna_changed.png) | ![1diff](./test/images/lenna_result.png) |\n| \u003cimg src=\"./test/images/empty_large.png\" width=\"200\"\u003e | \u003cimg src=\"./test/images/large.png\" width=\"200\"\u003e | \u003cimg src=\"./test/images/large_result.png\" width=\"200\"\u003e |\n\n### See Also\n\nFor reading and writing image files we used [stb single-file public domain libraries](https://github.com/nothings/stb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Fnkar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahancho%2Fnkar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Fnkar/lists"}