mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fixed boundary check
This commit is contained in:
parent
18b2d915a3
commit
2aa391cfa9
@ -156,7 +156,7 @@ void imlib_mean_filter(image_t *img, const int ksize, bool threshold, int offset
|
||||
continue; // Short circuit.
|
||||
}
|
||||
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y <= img->h-ksize) {
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y < img->h-ksize) {
|
||||
for (int j = -ksize; j <= ksize; j++) {
|
||||
uint32_t *k_row_ptr = IMAGE_COMPUTE_BINARY_PIXEL_ROW_PTR(img, y + j);
|
||||
acc -= IMAGE_GET_BINARY_PIXEL_FAST(k_row_ptr, x - ksize - 1);
|
||||
@ -219,7 +219,7 @@ void imlib_mean_filter(image_t *img, const int ksize, bool threshold, int offset
|
||||
IMAGE_PUT_GRAYSCALE_PIXEL_FAST(buf_row_ptr, x, IMAGE_GET_GRAYSCALE_PIXEL_FAST(row_ptr, x));
|
||||
continue; // Short circuit.
|
||||
}
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y <= img->h-ksize) {
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y < img->h-ksize) {
|
||||
for (int j = -ksize; j<= ksize; j++) {
|
||||
uint8_t *k_row_ptr = IMAGE_COMPUTE_GRAYSCALE_PIXEL_ROW_PTR(img, y+j);
|
||||
acc -= IMAGE_GET_GRAYSCALE_PIXEL_FAST(k_row_ptr, x-ksize-1);
|
||||
@ -282,7 +282,7 @@ void imlib_mean_filter(image_t *img, const int ksize, bool threshold, int offset
|
||||
IMAGE_PUT_RGB565_PIXEL_FAST(buf_row_ptr, x, IMAGE_GET_RGB565_PIXEL_FAST(row_ptr, x));
|
||||
continue; // Short circuit.
|
||||
}
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y <= img->h-ksize) {
|
||||
if (!mask && x > ksize && x < img->w-ksize && y >= ksize && y < img->h-ksize) {
|
||||
for (int j= -ksize; j<=ksize; j++) {
|
||||
uint16_t *k_row_ptr = IMAGE_COMPUTE_RGB565_PIXEL_ROW_PTR(img, y+j);
|
||||
// subtract last left-most pixel from the sums
|
||||
|
||||
Loading…
Reference in New Issue
Block a user