Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example for "preprocessedImageForTesseract"
func preprocessedImageForTesseract(tesseract: G8Tesseract!, sourceImage: UIImage!) -> UIImage! {
var filteredImage = UIImage()
switch threshold_mode {
case ThresholdMode.AdaptiveThreshold :
// Using AdaptiveThreshold
let adaptiveFilter = GPUImageAdaptiveThresholdFilter()
adaptiveFilter.blurRadiusInPixels = 4.0
filteredImage = adaptiveFilter.imageByFilteringImage(sourceImage)
return filteredImage
case ThresholdMode.AvarageLuminessence :
// Using AverageLuminace Filter
let avarageFilter = GPUImageAverageLuminanceThresholdFilter()
avarageFilter.thresholdMultiplier = 1.0
filteredImage = avarageFilter.imageByFilteringImage(sourceImage)
return filteredImage
// Using default Image-thresholding method
return nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment