1

I've been using the Microsoft OCR API and I'm getting the text from the images but I would like to know if the text is in an specific color or has an specific background color.

For example I have the following image and I would like to know if there is text in red i.e. image

I thought that this line:

 string requestParameters = "language=unk&detectOrientation=true";

would help me to establish the parameters I'd like to recieve from the image so if I wanted to know the color in a line of words. So I added a visual feature like this:

 string requestParameters = "visualFeatures=Color,language=unk&detectOrientation=true";

But this did not solve the problem.

Also: Can I mix the uriBase link from the image analysis and the one from the OCR?

Nancy Cruz
  • 115
  • 1
  • 10
  • Inventing your own URL parameter for calling a 3rd party service seems to be a strange kind of idea. When looking at [the documentation](https://southeastasia.dev.cognitive.microsoft.com/docs/services/56f91f2d778daf23d8ec6739/operations/56f91f2e778daf14a499e1fc), there is no URL parameter defined to get the color. On the other hand, [this example](https://learn.microsoft.com/en-us/azure/cognitive-services/computer-vision/quickstarts/python) acutally uses a `visualFeatures` parameter together with `Color`. – Uwe Keim Jun 22 '17 at 21:14
  • 1
    I think you are right. I thougth this posibility because the URL is proposed by Microsoft. When you analyze an image you can get visual features like categories, descrition(tags) and colors, etc. So I just mixed the request parameters from the analyze of an image with the request parameters of an OCR. I never noticed the the uriBase was diferent. So _Can I mix both uriBase (the one from image analysis and the one from OCR)?_ – Nancy Cruz Jun 22 '17 at 21:27

2 Answers2

2

There is currently no way to retrieve the color information and OCR results in a single call.

You could try using the bounding boxes returned from OCR to crop the original image, and then send the crop it to the analyze endpoint with visualFeatures=color to get the color information for the detected text.

  • So, there is no way I can use both uriBase (from image analysis and OCR) at the same time? I should build another method for the exclusive image analysis right? – Nancy Cruz Jun 22 '17 at 21:36
  • Yes, OCR requests go to /ocr, whereas analysis goes to /analyze. You'll need to first make a call to /ocr?language=unk&detectOrientation=true then a second call to /analyze?visualFeatures=color – Chris Sienkiewicz Jun 22 '17 at 21:40
0

According to documentation, the possible request parameters of this api are:

language, detectOrientation

and the returned metadata has these entities:

orientation, language, regions, lines, words, boundingBox, text

It will be possible to combine the OCR algorithm with another one of the computer vision algorithms to detect the dominating colors in the text regions that the OCR identified.

Cee McSharpface
  • 8,493
  • 3
  • 36
  • 77