Skip to content

evosystem-jp/objectSizeMeasurer

Repository files navigation

Measure size of objects in an image using JavaCV

The project provides a script to read an image and draw objects contours.

Constraints

  1. Shadow effect: use dark background
  2. Object boundry: use contrasting background

Getting Started

Prerequisites

  1. Java 8 (maybe or higher)
  2. Maven

Installing

  1. Clone repository
  • git clone https://github.com/evosystem-jp/objectSizeMeasurer.git
  1. Install dependencies
  • mvn install

Run

For image file

mvn exec:java -Dexec.mainClass="jp.evosystem.objectSizeMeasurer.mains.ImageFileObjectSize"

For video file

mvn exec:java -Dexec.mainClass="jp.evosystem.objectSizeMeasurer.mains.VideoFileObjectSize"

For web camera image

mvn exec:java -Dexec.mainClass="jp.evosystem.objectSizeMeasurer.mains.WebCameraObjectSize"

Algorithm

  1. Image pre-processing
  • Read an image and convert it it no grayscale
  • Blur the image using Gaussian Kernel to remove un-necessary edges
  • Edge detection using Canny edge detector
  • Perform morphological closing operation to remove noisy contours
  1. Object Segmentation
  • Find contours
  • Remove small contours by calculating its area (threshold used here is 100)
  • Sort contours from left to right to find the reference objects
  1. Compute results
  • Draw bounding boxes around each object and calculate its height and width

Results

Result

Authors

  • Evosystem, Inc.

Acknowledgments