You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For opencv_contrib/modules/ximgproc/src/seeds.cpp
lines 136-141
//compute initial label for sublevels: level <= seeds_top_level
//this is an equally sized grid with size nr_h[level]*nr_w[level]
int computeLabel(int level, int x, int y) {
return std::min(y / (height / nr_wh[2 * level + 1]), nr_wh[2 * level + 1] - 1) * nr_wh[2 * level]
+ std::min((x / (width / nr_wh[2 * level])), nr_wh[2 * level] - 1);
}
When processing a large number of images, a program crash can occur with a divide by zero error in the above function. This can be rectified by changing to the following:
//compute initial label for sublevels: level <= seeds_top_level
//this is an equally sized grid with size nr_h[level]*nr_w[level]
int computeLabel(int level, int x, int y) {
return std::min(y * nr_wh[2 * level + 1] / height), nr_wh[2 * level + 1] - 1) * nr_wh[2 * level]
+ std::min((x * nr_wh[2 * level] / width)), nr_wh[2 * level] - 1);
}
The text was updated successfully, but these errors were encountered:
When processing a large number of images, a program crash can occur with a divide by zero error in the above function. Changing the order of multiplication / division avoids a division by zero.
Detailed description
For opencv_contrib/modules/ximgproc/src/seeds.cpp
lines 136-141
When processing a large number of images, a program crash can occur with a divide by zero error in the above function. This can be rectified by changing to the following:
The text was updated successfully, but these errors were encountered: