1

I'm making a object detection app in React Native. I send image to Google Vision Api and the api send back a JSON file that contain coordinate and size of objects. I want to draw rectangles that indicate objects. I don't know what is the proper way to do that. I'm trying put div elements on image for that. But there is a problem: My image element has resizeMode='contain' attirubute. So I don't know where is the x = 0, y = 0 point, what is the size.

<Image source = ... resizeMode='contain' style={{flex: 1}}/>

What can I do to get real position and size of image? Or is there any advice to draw that reactangles?

NewPeople
  • 21
  • 1

1 Answers1

0

You can get image size as mentioned here https://stackoverflow.com/a/41864681/7873829. Once you have its size it'll be in the center of the image component container.

Shoaib Ahmed
  • 435
  • 4
  • 10