0

I have an image. How can I find the coordinate of four corners of the quadrilateral. Is there a way I can click at the corners of the quadrilateral to extract their coordinates.

I have a code below with predefined x and y limits.

enter image description here

library(ggplot2) # to plot
library(png) # to read image
library(ggpubr) # background image 


imag = readPNG("del.png")

ggplot() + 
  xlim(0, 10) + 
  ylim(30, 45) + 
  background_image(imag) + 
  coord_equal()
SiH
  • 1,378
  • 4
  • 18
  • I believe this is a duplicate of https://stackoverflow.com/q/9450873/3358272, can you please confirm? (That is, use `grid::grid.locator`.) – r2evans Dec 08 '21 at 22:37
  • @r2evans thanks. I tried `grid.locator()` but it give results in very different units. I want to get my results in the same units i.e. - x (0, 10) and y(30,45) – SiH Dec 08 '21 at 22:47
  • The linked answer uses `grid.locator("npc")` and then uses `min` and `range` with those numbers to determine the *coordinates* of the click. Have you tried that? – r2evans Dec 08 '21 at 23:37

0 Answers0