Search code examples
google-cloud-vision

Converting Normalized Vertex to Vertex in Google Cloud Vision


Any idea how can I convert Normalized Vertex to Vertex? Normalized Vertex gives me relative position on an image whereas the Vertex returns coordinates based on the scale of the image. I have a set of Normalized Vertex that I would like to convert it to regular Vertex.

https://cloud.google.com/vision/docs/reference/rest/v1p2beta1/images/annotate#normalizedvertex


Solution

  • If you know the size of your image (it's width and height), you can simply multiply it with your NorrmalizedVertex. You should multiply the x field of your NormalizedVertex with the width of the picture to get the x field of the Vertex and multiply the y field of your NormalizedVertex with the height of the image to get the y of the Vertex.