dahtah / imager

R package for image processing
GNU Lesser General Public License v3.0
187 stars 43 forks source link

<SOLVED> Output of "highlight" function #133

Closed mconsidine closed 4 years ago

mconsidine commented 4 years ago

Hi again, Short version: I'm trying to get the output of the "highlight" function to be a list/vector/etc of coordinate pairs, but see that is instead a list of ... lists?? How can I reframe the output so that I can sort the pairs based on x or y values?

Long version: I'm making progress calculating the circles and arcs that are in an image. What I would like to do is be able to pick off the coordinates of the points that make up the edge that I find. For example, this code:

library(imager)

test_url <- "http://www.considine.net/test5.jpg"

im <- load.image(test_url) plot(im)

out <- cannyEdges(im)

out <- threshold(im)#, "80%")

highlight(out, lwd=1)

draws a nice red line around the edge of the sun. What I want to be able to do is something like temp <- highlight(out,lwd=1) and then look at temp to pick off the coordinates of the ends of the arc (and the middle, incidentally).

But "temp" ends up being a structure that I don't quite understand. Can anyone suggest how it can be turned into a list of coordinate pairs?

TIA, Matt

mconsidine commented 4 years ago

I think now that mapping the pixset "out" onto the output of pixset.grid may work. But it seems kludgy... Matt

mconsidine commented 4 years ago

Solved using pixset...