finding coordinate of sketch image (eg. scanned as photo format) in r or other software

后端 未结 2 1878
天命终不由人
天命终不由人 2021-02-03 13:30

I want to redraw any sketch within R with polygon. But I need a painstaking work to find coordinates (X or Y values for each points).

2条回答
  •  滥情空心
    2021-02-03 13:57

    In R you may want to look at the digitize package, it has tools for reading a jpeg image and clicking on the image to get the points for the polygon(s). I belive that some of the spatial packages have some similar functionality for maps, but don't remember which packages).

    You can do something similar by plotting your image using the image or rasterImage function (see the EBImage or other packages for reading in the jpeg), then using the locator function (see the type argument) to click on the plot and get the coordinates. If you want to specify a different coordinate system then look at the updateusr function in the TeachingDemos package.

    For a more automated approach you can look at the potrace program. Inkscape has a builtin call to potrace with a little nicer interface and more options for preprocessing and postproccessing the image.

提交回复
热议问题