GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - richclement/ImageDiff: A library for producing diffs of images with highlighting.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
docs/images
docs/images
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Build status

ImageDiff

A .Net library for comparing images and highlighting the differences.

ImageDiff has three stages to its processing.

  1. Analyze the provided images.
  2. Detect and label the differences between the images.
  3. Build the bounding boxes for the identified blobs.

After processing is finished, it will generate a new image which is derived from the second image provided to the Compare method. This diff image will contain highlighted bounding boxes around the differences between the two images.

first image compared to second image produces image diff

Usage

Default usage:

var firstImage = new Bitmap("path/to/first/image");
var secondImage = new Bitmap("path/to/second/image);

var comparer = new BitmapComparer();
var diff = comparer.Compare(firstImage, secondImage);

When initialized without options, the following values are used:

  • AnalyzerType: ExactMatch
  • Labeler: Basic
  • JustNoticeableDifference: 2.3
  • DetectionPadding: 2
  • BoundingBoxPadding: 2
  • BoundingBoxColor: Red
  • BoundingBoxMode: Single

The compare object can be configured to use different settings for the different stages of processing.

var options = new CompareOptions 
{
	AnalyzerType = AnalyzerTypes.CIE76,
    JustNoticableDifference = 2.3,
    DetectionPadding = 2,
    Labeler = LabelerTypes.ConnectedComponentLabeling,
    BoundingBoxColor = Color.Red,
    BoundingBoxPadding = 2,
    BoundingBoxMode = BoundingBoxModes.Multiple
};
var comparer = new BitmapComparer(options);

Analyzer Type

Two forms of image analysis are currently supported:

  • ExactMatch - requires that the RGB values of each pixel in the image be equal.
  • CIE76 - follows the color difference formula to generate a Euclidean distance between the colors in the pixels and flags a difference when the Just Noticeable Difference (JND) is greater than a value of 2.3.

Just Noticeable Difference

Specify this to control how distant two pixels can be in the color space before they are marked as different.

Detection Padding

How many pixels away from the current pixel to look, for neighbors that should be grouped together for labeling purposes.

Labeler

Two forms of blob labeling are currently supported:

  • Basic - basic labeling will group all differences together into a single group. This labeling format does not support BoundingBoxMode.Multiple.
  • Connected Component Labeling - Uses a two-pass algorithm to label the differences in an image and then aggregate the labels. The Detection Padding option is used to determine how far to travel when checking neighbor pixels.

Bounding Box Color

The color of the bounding box to be drawn when highlighting detected differences.

Bounding Box Padding

The number of pixels of padding to include around the detected difference when drawing a bounding box.

Bounding Box Mode

Specifies how to build the bounding boxes when highlighting the detected differences.

  • Single - Only generate one bounding box that encompasses all of the detected differences in the image.
  • Multiple - Generate a bounding box around each separate group of detected differences. This bounding box mode is not supported by LabelerTypes.Basic.

About

A library for producing diffs of images with highlighting.

Resources

Readme
MIT license
Activity

Stars

40 stars

Watchers

4 watching

Forks

17 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.