I'm using tesseract in my iPhone application.
I tried several filters on my image for converting it to a grayscale image, however I'd like to have the result where a threshold is being set so that the only pixels which are inside the image are black or white.
I succeeded with using apples grayscale filter which gives the appropriate result. However it's still a 16 bit image (correct me if I'm wrong). The filtering which I'm using at the moment is as follows:
- (UIImage *) grayishImage:(UIImage *)i {
// Create a graphic context.
UIGraphicsBeginImageContextWithOptions(i.size, YES, 1.0);
CGRect imageRect = CGRectMake(0, 0, i.size.width, i.size.height);
// Draw the image with the luminosity blend mode.
[i drawInRect:imageRect blendMode:kCGBlendModeLuminosity alpha:1.0];
// Get the resulting image.
UIImage *filteredImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return filteredImage;
}
Can anyone supply me with the filter to get pure black and white pixels and not grayscale images?