Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Raspberry Pi Computer Vision Programming. - Second Edition

You're reading from  Raspberry Pi Computer Vision Programming. - Second Edition

Product type Book
Published in Jun 2020
Publisher Packt
ISBN-13 9781800207219
Pages 306 pages
Edition 2nd Edition
Languages
Author (1):
Ashwin Pajankar Ashwin Pajankar
Profile icon Ashwin Pajankar

Table of Contents (15) Chapters

Preface 1. Chapter 1: Introduction to Computer Vision and the Raspberry Pi 2. Chapter 2: Preparing the Raspberry Pi for Computer Vision 3. Chapter 3: Introduction to Python Programming 4. Chapter 4: Getting Started with Computer Vision 5. Chapter 5: Basics of Image Processing 6. Chapter 6: Colorspaces, Transformations, and Thresholding 7. Chapter 7: Let's Make Some Noise 8. Chapter 8: High-Pass Filters and Feature Detection 9. Chapter 9: Image Restoration, Segmentation, and Depth Maps 10. Chapter 10: Histograms, Contours, and Morphological Transformations 11. Chapter 11: Real-Life Applications of Computer Vision 12. Chapter 12: Working with Mahotas and Jupyter 13. Chapter 13: Appendix 14. Other Books You May Enjoy

Harris corner detection

OpenCV has the cv2.cornerHarris() function for detecting corners. Its arguments are as follows:

  • img: The input image, which must be grayscale and have the float32 type.
  • blockSize: This is the size of the neighborhood considered for corner detection.
  • ksize: The aperture parameter of the Sobel derivative used.
  • k: The free Harris detector parameter used in the equation.

The following is an example program that implements Harris corner detection:

import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('/home/pi/book/dataset/4.1.05.tiff', 0)
img = np.float32(img)
dst = cv2.cornerHarris(img, 2, 3, 0.04)
ret, dst = cv2.threshold(dst, 0.01*dst.max(), 255, 0)
dst = np.uint8(dst)
plt.imshow(dst, cmap='gray')
plt.axis('off')
plt.show()

In the preceding program, we coverted the image into 32-bit float format and then we fed it to the corner detection function. Then, we threshholded the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}