MaybeShewill-CV / sky-detector

Sky area detection without deep neural networks https://maybeshewill-cv.github.io/sky-detector/
146 stars 42 forks source link

out of index error while access border array #10

Closed huntkao closed 3 years ago

huntkao commented 3 years ago

in the functions has_sky_region(...) and has_partial_sky_region(...) in imageSkyDetector.cpp, the following code:

std::vector<int> border_diff(static_cast<int>(border.size() - 1), 0); for (auto i = static_cast<int>(border.size() - 1); i >= 0; i--) { border_diff[i] = std::abs(border[i + 1] - border[i]); }

makes access violation error. Since the index i+1 exceeds the size of array border ?