Daisy Descriptors

In this post I will experiment with the DAISY descriptors. Please note that one of the simplest approaches is to alter parameters in the different functions and observe the results. In addition you should look up the functions in the scikit-image to get a better understanding of the function and arguments e.g., skimage.feature.daisy.

The motivation for this post is the PluralSight course by Janani Ravi. She uses the Jupyter notebook in the course. We will use the VSCode IDE with GitHub Copilot. This helps experiment with the code. At this point I would like to disclose that I am a Microsoft employee and use the VSCode IDE with GitHub Copilot extension. Have been using VSCode for a few years. In the past few months I started using GitHub Copilot.


# **** folder of interest ****
cd C:\Documents\_Image Processing\scikit-image-building-image-processing-applications\02\demos

# **** open file of interest using VSCode ****
(base) C:\Documents\_Image Processing\scikit-image-building-image-processing-applications\02\demos>code DaisyDescriptors.py

# **** execute python script of interest ****
(base) C:\Documents\_Image Processing\scikit-image-building-image-processing-applications\02\demos>python DaisyDescriptors.py


We will start by opening an Anaconda Prompt. Then we will move to the folder of interest in which we will save our Python script. We then open the VSCode IDE with the name of the script. Of course you can select a different name if you please.

Once VSCode opens, we need to save changes. This will get the script ready to be executed.

The final step is to run the Python script.

# **** ****
import matplotlib.pyplot as plt

import skimage
from skimage import color
from skimage.feature import daisy
from skimage import data

As usual we will start by including the libraries / functions we will be using in the script. In particular, for this script, we need to include the DAISY library.

# **** load the RGB pexels-cars.jpg image ****
cars = skimage.io.imread('./images/pexels-cars.jpg')

# **** show RGB cars image ****
plt.figure(figsize=(10, 8)) # set the size of the figure
plt.imshow(cars, interpolation='nearest') # display the image
plt.title('cars') # set the title
plt.show() # show the image

We start by loading a RGB JPEG image of two cars. We then display the image to get a visualization of what we are dealing with.


# **** convert the car image to grayscale ****
cars = color.rgb2gray(cars)

# **** show cars image ****
plt.figure(figsize=(10, 8))                 # set the size of the figure
plt.imshow(cars, cmap='gray')               # display the image
plt.title('cars - gray')                    # set the title
plt.show()                                  # show the image

To use the DAISY library we will convert the RGB image to grayscale. Once again we will display the grayscale image to verify all is well so far.


# **** compute the daisy descriptors for the cars image ****
descs_array, descs_image = daisy(   cars, 
                                    step=200,           # distance between descriptor sampling points
                                    radius=20,          # radius (in pixels) of the outermost ring
                                    visualize=True)     # generate a visualization of the DAISY descriptors

# ****  show the daisy descriptors number ****
descs_num = descs_array.shape[0] * descs_array.shape[1]

# **** show the daisy descriptors number 
#      features lie on high-contrast regions such as object edges ****
print(f'descs_num: {descs_num}')

# **** show the descs_image ****
plt.figure(figsize=(12, 10))                 # set the size of the figure
plt.title(label='descs_image')               # set the title
plt.imshow(descs_image)                      # display the image
plt.show()                                   # show the image

We are now ready to compute the DAISY descriptors. Once we get a first pass, it is good to alter them and observe the results. In addition take a look at the documentation on the function for other possible arguments.

The final step is to display the image showing the DAISY descriptors.



After editing the code and experimenting with it, it seems that the subject would require additional reading. Keep in mind that the object of this post is to provide a simple introduction to this subject.

If interested in the Python code in this post, you may find it in my GitHub repository.

Remember that one of the best ways to learn is to read, experiment, and repeat.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.