GithubHelp home page GithubHelp logo

image-comparison-opencv-cpp's Introduction

This C++ code uses the OpenCV library to perform image comparison. Each function description is given as follows-

  • The match_template function performs template matching. It takes two images as input: the source image and the template image. The function checks if the images are loaded correctly, then it creates a result matrix to store the result of the template matching. The matchTemplate function from OpenCV is used to compare the template image with the source image. The result is then normalized to fall within a certain range. The function then finds the location of the best match using the minMaxLoc function. Depending on the matching method used, the best match could be the maximum or minimum value in the result matrix. The location of the best match is then used to draw a rectangle on the source image and the result matrix. The images are then displayed using imshow.

  • The histogram_comparison function performs histogram comparison. It takes three images as input: the source image and two test images. The images are converted to the HSV color space using the cvtColor function. Histograms for the base image, the two test images, and the half-down base image are calculated using the calcHist function and normalized. The function then compares the histogram of the base image with the other histograms using the compareHist function. The results are printed to the console.

  • The image_subtraction function performs image subtraction. It takes two images and a result matrix as input. The images are converted to the HSV color space and then subtracted from each other using the subtract function. The result is then displayed.

  • The histogram_calculation function calculates the histogram of two images. The images are split into their BGR channels using the split function. Histograms for each channel are calculated using the calcHist function and normalized. The function then draws the histograms for each color channel and displays them.

In the main function, the user is asked to choose a comparison method. Depending on the user's choice, the corresponding function is called to perform the comparison. The images used for comparison are loaded from the file system.

image-comparison-opencv-cpp's People

Contributors

6six7sven avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.