opencv icon indicating copy to clipboard operation
opencv copied to clipboard

if no method is specified in keypoints, it crashes

Open rmflight opened this issue 3 years ago • 2 comments

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.

rmflight avatar Dec 23 '20 19:12 rmflight

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

jwijffels avatar Dec 23 '20 22:12 jwijffels

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

Functions should work with default arguments.

Hence the pull request.

rmflight avatar Dec 23 '20 23:12 rmflight