Edge / Line Detection
Best results are obtained by finding edges with image_canny() and
then performing Hough-line detection on the edge image.
image_edge(image, radius = 1)
image_canny(image, geometry = "0x1+10%+30%")
image_hough_draw(
  image,
  geometry = NULL,
  color = "red",
  bg = "transparent",
  size = 3,
  overlay = FALSE
)
image_hough_txt(image, geometry = NULL, format = c("mvg", "svg"))image | 
 magick image object returned by   | 
radius | 
 edge size in pixels  | 
geometry | 
 geometry string, see details.  | 
color | 
 a valid color string such as
  | 
bg | 
 background color  | 
size | 
 size in points to draw the line  | 
overlay | 
 composite the drawing atop the input image. Only for   | 
format | 
 output format of the text, either   | 
For Hough-line detection, the geometry format is {W}x{H}+{threshold}
defining the size and threshold of the filter used to find 'peaks' in
the intermediate search image. For canny edge detection the format is
{radius}x{sigma}+{lower%}+{upper%}. More details and examples are
available at the imagemagick website.
if(magick_config()$version > "6.8.9"){
shape <- demo_image("shape_rectangle.gif")
rectangle <- image_canny(shape)
rectangle %>% image_hough_draw('5x5+20')
rectangle %>% image_hough_txt(format = 'svg') %>% cat()
}Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.