1

I'm trying to work with OCR, and I'm following this tutorial:

https://community.idolondemand.com/t5/Blog/Tutorial-OCR-on-Google-Glass/ba-p/1164

But it not works good with Glass.

The camera shows unreal colors... The color of the skin is blue :( And I don't know how to solve it. I have modified the code to start the camera like this:

@Override
public void surfaceCreated(SurfaceHolder holder) {
    camera = Camera.open();

    Camera.Parameters params = camera.getParameters(); //added
    params.setPreviewFpsRange(30000, 30000); //added
    params.setPreviewSize(640,360); //added
    camera.setParameters(params); //added

    // Show the Camera display
    try {
        camera.setPreviewDisplay(holder);
    } catch (IOException e) {
        this.releaseCamera();
    }
}

With this problem, I can try to use the OCR and not recognize well the text of the images... But, can it be related to the camera problem?

Is there any other API to do OCR?

adlagar
  • 877
  • 10
  • 31

1 Answers1

0

If the colour of skin is blue, it may be that you are pulling the frames in BGR format, and then trying to display it in RBG. Some computer vision libraries such as OpenCV use BGR, try swapping the index's round of each frame from BGR to RGB and see if that solves your colour issues.

Also if you are struggling with your OCR API this tutorial may be useful for you.

It will explain how to use Neural networks in android environment, which can be used for OCR among many other things.

Aphire
  • 1,621
  • 25
  • 55
  • And how I can change BGR to RGB exactly? Thanks for your reply! – adlagar Apr 17 '15 at 11:28
  • If you have access to the data for each pixel, you should find that each pixel is stored as an array with 3 index's, one for red, green and blue. If you can pull the values of each of these, you can create a new image, and populate the image information with the pixel data you managed to pull from the original image, except when you do this, you can re-arrange the data so that it is in the right place (I hope this makes sense, im afraid I don't have code to show you) – Aphire Apr 17 '15 at 13:08
  • Or if you are using some kind of image processing library, there may be a function that does this for you (in OpenCV it would be cvtColor) – Aphire Apr 17 '15 at 13:29
  • I don't have access to the data for each pixel :( – adlagar Apr 19 '15 at 21:05