diff --git a/impl/ocean/cv/segmentation/FrameFilterBlur.h b/impl/ocean/cv/segmentation/FrameFilterBlur.h index efabdcd71..08f85f6b5 100644 --- a/impl/ocean/cv/segmentation/FrameFilterBlur.h +++ b/impl/ocean/cv/segmentation/FrameFilterBlur.h @@ -133,6 +133,14 @@ bool FrameFilterBlur::blurMaskRegions8BitPerChannel(uint8_t* image, const uint8_ } } + ocean_assert(pixels != 0); + ocean_assert(pixelBoundingBox.isValid()); + + if (pixels == 0) + { + return false; + } + uint8_t averageColors[tChannels]; for (unsigned int n = 0u; n < tChannels; ++n) @@ -145,8 +153,6 @@ bool FrameFilterBlur::blurMaskRegions8BitPerChannel(uint8_t* image, const uint8_ } } - pixels = 0u; - for (unsigned int y = pixelBoundingBox.top(); y < pixelBoundingBox.bottomEnd(); ++y) { const uint32_t* const rowSepartion = separation.constrow(y); @@ -160,8 +166,6 @@ bool FrameFilterBlur::blurMaskRegions8BitPerChannel(uint8_t* image, const uint8_ { rowImage[x * tChannels + n] = averageColors[n]; } - - ++pixels; } } } @@ -176,6 +180,8 @@ bool FrameFilterBlur::blurMaskRegions8BitPerChannel(uint8_t* image, const uint8_ ocean_assert(maskBlocks.size() == pixelBoundingBoxes.size()); + CV::PixelPositions borderPixels; + for (size_t n = 0; n < maskBlocks.size(); ++n) { const CV::PixelBoundingBox& pixelBoundingBox = pixelBoundingBoxes[n]; @@ -193,8 +199,6 @@ bool FrameFilterBlur::blurMaskRegions8BitPerChannel(uint8_t* image, const uint8_ Frame blendMask = imageMask.subFrame(extendedBoundingBox.left(), extendedBoundingBox.top(), extendedBoundingBox.width(), extendedBoundingBox.height(), Frame::CM_COPY_REMOVE_PADDING_LAYOUT); - CV::PixelPositions borderPixels; - for (unsigned int iteration = 1u; iteration < blurBorder; ++iteration) { borderPixels.clear();