1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

fix calculation of velocity matrix size in rb_optical_flow_bm

see http://code.opencv.org/issues/1362
This commit is contained in:
ser1zw 2012-04-22 23:03:54 +09:00
parent 55f57e7eed
commit 4f391d6efb

View file

@ -5404,8 +5404,8 @@ rb_optical_flow_bm(int argc, VALUE *argv, VALUE self)
int use_previous = 0;
try {
CvSize image_size = cvGetSize(self_ptr);
CvSize velocity_size = cvSize((image_size.width - block_size.width) / shift_size.width,
(image_size.height - block_size.height) / shift_size.height);
CvSize velocity_size = cvSize((image_size.width - block_size.width + shift_size.width) / shift_size.width,
(image_size.height - block_size.height + shift_size.height) / shift_size.height);
CvMat *velx_ptr, *vely_ptr;
if (NIL_P(velx) && NIL_P(vely)) {
int type = CV_MAKETYPE(CV_32F, 1);