GithubHelp home page GithubHelp logo

dbarac / sift-cpp Goto Github PK

View Code? Open in Web Editor NEW
26.0 1.0 9.0 2.98 MB

A C++ SIFT implementation (Scale invariant feature transform)

C++ 9.40% C 90.43% CMake 0.17%
feature-matching sift computer-vision feature-detection

sift-cpp's Introduction

sift-cpp

Introduction

This is a C++ implementation of SIFT, a feature detection algorithm.

Libraries used

stb_image and stb_image_write for loading and saving images. (included in this repo)

Usage example

Find keypoints, match features in two images and save the result:

#include <vector>
#include "image.hpp"
#include "sift.hpp"

int main()
{
    Image img("./../imgs/book_rotated.jpg");
    Image img2("./../imgs/book_in_scene.jpg");
    img = rgb_to_grayscale(img);
    img2 = rgb_to_grayscale(img2);
    std::vector<sift::Keypoint> kps1 = sift::find_keypoints_and_descriptors(img);
    std::vector<sift::Keypoint> kps2 = sift::find_keypoints_and_descriptors(img2);
    std::vector<std::pair<int, int>> matches = sift::find_keypoint_matches(kps1, kps2);
    Image book_matches = sift::draw_matches(img, img2, kps1, kps2, matches);
    book_matches.save("book_matches.jpg");
    return 0;
}

Result: Matching result

Build and run the examples

Build

$ mkdir build/ && cd build && cmake .. && make

The executables will be in sift-cpp/bin/.

Run

Find image keypoints, draw them and save the result:

$ cd bin/ && ./find_keypoints ../imgs/book_rotated.jpg

Input images can be .jpg or .png. Result image is saved as result.jpg

Keypoints result

Find keypoints in two images and match them, draw matches and save the result:

$ cd bin/ && ./match_features ../imgs/book_rotated.jpg ../imgs/book_in_scene.jpg

Result image is saved as result.jpg

Useful links

sift-cpp's People

Contributors

dbarac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sift-cpp's Issues

I need a permission.

Hello,

Thank you for the awesome work. I have translated this SIFT implementation to dlang to include it in DCV (an open-source CV library). I am one of the maintainers. Of course, all the credit will be given to @dbarac by explicitly mentioning in the source file and a reference to this repo.

Thanks in advance
Ferhat

https://github.com/libmir/dcv

Comparison report

Thanks for this great project. Did you compare this implementation of SIFT with the OpenCV version? In terms of output, computation time and other performance parameters.

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.