/Image-Feature-Matching-with-Julia

Image Feature Matching with Julia using freak descriptor

Primary LanguageJuliaApache License 2.0Apache-2.0

# Image Feature Matching with Julia

This code demonstrates how to perform image feature matching using Julia programming language, specifically utilizing the `ImageFeatures.jl`, `Images.jl`, `Rotations.jl`, `ImageDraw.jl`, and `CoordinateTransformations.jl` packages.

## Usage

1. Install the required Julia packages:
   ```julia
   using Pkg
   Pkg.add("ImageFeatures")
   Pkg.add("Images")
   Pkg.add("Rotations")
   Pkg.add("ImageDraw")
   Pkg.add("CoordinateTransformations")
  1. Load the necessary packages:

    using ImageFeatures
    using Images
    using Rotations, ImageDraw, CoordinateTransformations
  2. Load the image:

    img = load("wp2788550-adventure-time-wallpaper-deviantart.jpg")
  3. Convert the image to grayscale:

    img_gray = Gray.(img)
  4. Perform rotation:

    img_rotated = rotation(img_gray)
  5. Calculate keypoints:

    kp1, kp2 = keypoints_calculation(img_gray, img_rotated)
  6. Compute FREAK descriptors:

    freak_params = FREAK()
    desc1, ret1_kp = create_descriptor(img_gray, kp1, freak_params)
    desc2, ret2_kp = create_descriptor(img_rotated, kp2, freak_params)
  7. Match keypoints:

    matches = match_keypoints(ret1_kp, ret2_kp, desc1, desc2, 0.1)
  8. Visualize the results:

    grid = hcat(img_gray, img_rotated)
    offset = CartesianIndex(0, size(img_gray, 2))
    draw!(grid, [LineSegment(m[1], m[2] + offset) for m in matches])

Description

This code performs the following steps:

  • Loads an image and converts it to grayscale.
  • Rotates the grayscale image by a specified angle.
  • Calculates keypoints using the FAST corner detection algorithm.
  • Computes FREAK descriptors for the keypoints.
  • Matches keypoints between the original and rotated images.
  • Visualizes the matched keypoints on a grid image.

Requirements

  • Julia programming language
  • ImageFeatures.jl
  • Images.jl
  • Rotations.jl
  • ImageDraw.jl
  • CoordinateTransformations.jl

Credits

This code is without any guarantees. Feel free to modify and use it according to your requirements.