ropensci / opencv

R bindings for OpenCV
https://docs.ropensci.org/opencv
Other
137 stars 27 forks source link

if no method is specified in keypoints, it crashes #32

Open rmflight opened 3 years ago

rmflight commented 3 years ago

I included an example in #31

# this generates an error, when it really shouldn't
mona <- ocv_read('https://jeroen.github.io/images/monalisa.jpg')
mona <- ocv_resize(mona, width = 320, height = 477)
pts <- ocv_keypoints(mona, method = "FAST")

This errors on the latest dev of opencv, and R 4.0.0.

jwijffels commented 3 years ago

I'm not getting a crash, just an error about switch

> mona <- ocv_read('https://jeroen.github.io/images/monalisa.jpg')
trying URL 'https://jeroen.github.io/images/monalisa.jpg'
Content type 'image/jpeg' length 947984 bytes (925 KB)
downloaded 925 KB

> mona <- ocv_resize(mona, width = 320, height = 477)
> 
> # FAST-9
> pts <- ocv_keypoints(mona, method = "FAST")
Error in switch(params$type, TYPE_5_8 = 0L, TYPE_7_12 = 1L, TYPE_9_16 = 2L) : 
  EXPR must be a length 1 vector
rmflight commented 3 years ago

Sorry, yes, it doesn't crash, but generates an error.

Functions should work with default arguments.

Hence the pull request.