Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Segment Detector pixel matrix is 0 when union = T #8

Open
srvanderplas opened this issue Mar 19, 2018 · 1 comment
Open

Line Segment Detector pixel matrix is 0 when union = T #8

srvanderplas opened this issue Mar 19, 2018 · 1 comment

Comments

@srvanderplas
Copy link

image_line_segment_detector(img, union = T) returns a pixel matrix the size of the image with all 0 values. Ideally, this would also update when union = T so that joined lines are represented by the same number.

library(imager)
library(image.LineSegmentDetector)

im <- load.image(system.file('extdata/parrots.png', package='imager'))

im_pnm <- im %>%
  grayscale() %>%
  multiply_by(255)
im_pnm <- im_pnm[ , , 1, 1]

nounion <- image_line_segment_detector(im_pnm)
withunion <- image_line_segment_detector(im_pnm, union = T)

sum(nounion$pixels != 0) # 19414
sum(withunion$pixels != 0) # 0
@jwijffels
Copy link
Contributor

Yes, you are right, but that is not how it is implemented by the author of LSD line segment detector (original C code is here https://github.com/theWorldCreator/LSD). If union is set to 1, pixels are untouched.
I think you should post your question at that repository to get further details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants