thresholding image in java
Hi!
i'm pretty much new with opencv, started few days ago, and i would like to use opencv in image preprocessing for OCR. I have an image that represents a payment order (printed mainly in some kind of red) filled with typed text (black). My goal (for now) is to create an image that contains only typed text. Iterating through pixels doesn't seem as a solution, i guess it would be pretty much slow. so i guess some kind of thresholding would do the trick. but, the problem is i don't know how to do it. To be more precise, i don't know how to define threshold..
So far i've got this:
Mat image = Highgui.imread("file.jpg",Highgui.CV_LOAD_IMAGE_UNCHANGED);
Mat imageHSV = new Mat(image.size(), image.type());
Imgproc.cvtColor(image, imageHSV, Imgproc.COLOR_BGR2HSV);
At this point i should have HSV image. Now i should define a mask (or threshold)?
Mat mask = ???
and then i should use something like this
Core.inRange(imageHSV, scalarLower, scalarUpper, mask);
Some help would be appreciated... Thanks!