Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Text Detection of Google Vision API send back rotated boundingPolies from a phone camera

I tried many times, but only photos that is taken by a phone (pixel 7)
I was using my own system to mark up bounding poly, but this problem is happened in Demo page 

Like this:

onudon_1-1739015984623.png

This is raw file

onudon_0-1739057733528.jpeg

 

 

 

Solved Solved
0 1 335
1 ACCEPTED SOLUTION

Hi @onudon,

Welcome to Google Cloud Community!

It appears you're experiencing an issue with the Google Cloud Vision API returning bounding polygons that are rotated in an unexpected way. 

Here are some workarounds that you may try:

1. Remove Exchangeable Image File(EXIF) orientation data before upload:

  • This is the most common and often effective solution. Before sending the image to the Vision API, remove the EXIF orientation tag. 

2. Pre-process the image (Rotation Correction):

    • If simply removing the EXIF data doesn't work, you can try detecting any rotation angle and correct it before sending the image to the Vision API. 
    • Detect edges in the image (Canny Edge Detection).
    • Use the Hough Transform to detect lines.
    • Calculate the average angle of the lines.
    • Rotate the image by the negative of that angle.

3. Directly specify rotation in the request:

    • The Google Cloud Vision API has functionality for image context, and there is a rotation setting that might help. If you know that the image is consistently rotated by a specific angle, you can tell the API about that in the request in order to see if it is better able to interpret the bounding boxes accurately.

In addition, make sure the image is clear and well-lit. Blurry or low-resolution images can negatively affect the API's performance. Thoroughly test your solution with a variety of images to ensure it works consistently across different scenarios.

If the issue still persists you may contact Google Cloud Support for assistance or file a report through the issue tracker. This way you could have visibility on the progress of your case as it is publicly available. Please note that I can't provide any details or timelines at this moment. For future updates, I suggest keeping an eye out on the issue tracker.

Also, here are some useful links to the the Google Cloud Vision API's text detection capabilities:

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

 

View solution in original post

1 REPLY 1

Hi @onudon,

Welcome to Google Cloud Community!

It appears you're experiencing an issue with the Google Cloud Vision API returning bounding polygons that are rotated in an unexpected way. 

Here are some workarounds that you may try:

1. Remove Exchangeable Image File(EXIF) orientation data before upload:

  • This is the most common and often effective solution. Before sending the image to the Vision API, remove the EXIF orientation tag. 

2. Pre-process the image (Rotation Correction):

    • If simply removing the EXIF data doesn't work, you can try detecting any rotation angle and correct it before sending the image to the Vision API. 
    • Detect edges in the image (Canny Edge Detection).
    • Use the Hough Transform to detect lines.
    • Calculate the average angle of the lines.
    • Rotate the image by the negative of that angle.

3. Directly specify rotation in the request:

    • The Google Cloud Vision API has functionality for image context, and there is a rotation setting that might help. If you know that the image is consistently rotated by a specific angle, you can tell the API about that in the request in order to see if it is better able to interpret the bounding boxes accurately.

In addition, make sure the image is clear and well-lit. Blurry or low-resolution images can negatively affect the API's performance. Thoroughly test your solution with a variety of images to ensure it works consistently across different scenarios.

If the issue still persists you may contact Google Cloud Support for assistance or file a report through the issue tracker. This way you could have visibility on the progress of your case as it is publicly available. Please note that I can't provide any details or timelines at this moment. For future updates, I suggest keeping an eye out on the issue tracker.

Also, here are some useful links to the the Google Cloud Vision API's text detection capabilities:

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.