Skip to content

akramoo/coin-counting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Coin Detection and Classification System

Table of Contents

  1. Introduction
  2. System Steps
  3. Image Preprocessing Details
  4. Coin Segmentation
  5. Filtering Techniques
  6. Result Visualization
  7. Interface Visualization
  8. Conclusion
  9. References

Introduction

The goal of this project is to develop an automated system for detecting and recognizing coins using advanced image processing techniques. By leveraging computer vision, this system aims to:

  • Detect coins in an image
  • Segment them from the background
  • Classify coins based on size or nominal value

To enhance usability, an interactive GUI is developed using Tkinter. The system is implemented in Python to ensure both flexibility and robustness.


System Steps

Image Loading

The system loads images using the Pillow library and converts them to NumPy arrays for efficient pixel-level processing.

Image Preprocessing

Initial preprocessing steps include contrast enhancement, noise reduction, and dynamic range adjustments to prepare the image for further analysis.

Segmentation

The segmentation phase isolates coins from the background using techniques such as:

  • Classical thresholding
  • Otsu's method

Filtering

Different filters are applied to refine the image:

  • Median filter for noise removal
  • Gaussian filter for blurring
  • Sobel filter for edge detection

Detection and Analysis Methods

Key functions include:

  • binarize_image: Converts grayscale images into binary representations.
  • detect_large_circles: Identifies circular objects based on size and circularity.
  • display_results: Visualizes detected coins with overlays.
  • calculate_accuracy: Compares detected and actual coin counts.

User Interface

The GUI allows users to:

  • Upload images
  • View original and processed images side by side
  • See detailed analysis, including:
    • Number of coins detected
    • Accuracy percentage
    • Breakdown of coin categories (small, medium, large)

Image Preprocessing Details

Contrast Enhancement

Improves the visibility of features by adjusting brightness and contrast ratios.

Noise Reduction

Removes unwanted artifacts using techniques such as Gaussian noise reduction.

Dynamic Range Improvement

Expands the grayscale range to improve data representation.

Saturation Adjustment

Controls color intensity by modifying saturation levels in HSV or HSL color spaces.

Value Clamping

Restricts pixel values to a defined range to normalize image data.


Coin Segmentation

Thresholding

Segments the image into foreground and background using intensity-based thresholds.

Otsu's Method

Determines optimal threshold values by maximizing inter-class variance.


Filtering Techniques

Median Filter

Replaces each pixel with the median value of its neighbors, reducing salt-and-pepper noise.

Arithmetic Mean Filter

Calculates the average pixel intensity in a neighborhood, smoothing the image.

Gaussian Filter

Applies a weighted blur to the image, preserving edge details while reducing noise.

Laplacian Filter

Enhances edges by calculating the second derivative of pixel intensity.

Sobel Filter

Detects edges using gradient-based methods, highlighting changes in intensity.


Result Visualization

Results include:

  • Coin detection accuracy
  • Coin count comparison between detected and actual values

Interface Visualization

The GUI presents:

  • Original and processed images side by side
  • Clear visual indicators of detected coins
  • Summary of results with accuracy percentages

Conclusion

The system successfully detects and classifies coins with high accuracy. Advanced computer vision techniques enable robust segmentation and classification. The GUI ensures user-friendly interaction, making the system accessible for practical applications.


References

About

This project leverages computer vision to detect, segment, and classify coins by size or value. A Tkinter-based GUI and Python implementation ensure usability and robustness.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors