facebookresearch / segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.
Apache License 2.0
47.9k stars 5.67k forks source link

Assistance with Syncing Coordinates in OpenSeaDragon for Point Prompting in SAM #686

Open abhinav2712 opened 9 months ago

abhinav2712 commented 9 months ago

Description:

I am currently working with the Segment Anything model and OpenSeaDragon for image segmentation tasks involving point prompts. I have successfully implemented the basic functionality, but I am encountering challenges when it comes to synchronizing the coordinates of the zoomed images in OpenSeaDragon with the input requirements of the SAM model.

Specifically, I am unsure of how to translate the viewport coordinates captured during user interaction in OpenSeaDragon to the image coordinates that the SAM model expects. This is crucial for encoding the point prompts correctly, as the model requires precise coordinates relative to the original image size.

Could anyone provide guidance or examples on how to handle the coordinate conversion and scaling when dealing with zoom levels and tiled images in OpenSeaDragon? Any advice or resources that could help me implement this functionality would be greatly appreciated.

Reference materials: https://openseadragon.github.io/

abhinav2712 commented 9 months ago

@Celebio @nlutsenko @colesbury @pdollar @calebrob6 Would be glad if you all have a look at this, Thank you