Skip to content

nfergu/cclabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

CCLabel

Fast implementation of connected-component labelling in Swift. Currently only 4-connectivity is supported.

In CcLabel, call the labelImageFast function to label your image. Optionally, the bounding boxes of the components can be computed by passing-in true for the calculateBoundingBoxes parameter.

NOTE: Before processing, the image must first be binarized (all pixels must be either black or white). To binarize an image using the GPUImage library:

class func binarizeImage(image: UIImage) -> UIImage {
    let start = NSDate()
    let stillImageFilter = GPUImageAdaptiveThresholdFilter()
    stillImageFilter.blurRadiusInPixels = 4.0
    let filteredImage = stillImageFilter.imageByFilteringImage(image)
    let end = NSDate();
    print("Binarized image in " + String(end.timeIntervalSinceDate(start)) + " seconds")
    return filteredImage
}

TODO

  • Automated tests
  • Better documentation
  • Code tidy-up (break long methods up a bit)
  • Performance results
  • 8-connectivity

License

CCLabel is licensed under the Apache License, Version 2.0

About

Fast connected-component labelling in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages