Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Camshift misunderstand

Dear everyone, Can you help to explain below line of Camshift source code (https://github.com/opencv/opencv/blob/master/modules/video/src/camshift.cpp) : int nx = std::min(std::max(cur_rect.x + dx, 0), size.width - cur_rect.width); int ny = std::min(std::max(cur_rect.y + dy, 0), size.height - cur_rect.height);

this is the calculation for the new coordinate of the window, but I do not know how it can select minimum between "size.width - cur_rect.width" and "cur_rect.x + dx" .

Camshift misunderstand

Dear everyone, Can you help to explain below line of Camshift source code (https://github.com/opencv/opencv/blob/master/modules/video/src/camshift.cpp) : :

int nx = std::min(std::max(cur_rect.x + dx, 0), size.width - cur_rect.width);
     int ny = std::min(std::max(cur_rect.y + dy, 0), size.height - cur_rect.height);

cur_rect.height);

this is the calculation for the new coordinate of the window, but I do not know how it can select minimum between "size.width - cur_rect.width" and "cur_rect.x + dx" .