MLECO-2874: Move NMS out of the OD use_case
* Add ImageUtils
* Move image related code from UseCaseCommonUtils to ImageUtils
* Move NMS related code to ImageUtils
* Delete test specific ImageUtils and use new ImageUtils
Signed-off-by: Richard Burton <richard.burton@arm.com>
Change-Id: Icbf5dd9c6a941b0126ecdf69a0c9d9969f22729f
diff --git a/source/application/main/UseCaseCommonUtils.cc b/source/application/main/UseCaseCommonUtils.cc
index dd9a32d..d439446 100644
--- a/source/application/main/UseCaseCommonUtils.cc
+++ b/source/application/main/UseCaseCommonUtils.cc
@@ -15,6 +15,7 @@
* limitations under the License.
*/
#include "UseCaseCommonUtils.hpp"
+#include "ImageUtils.hpp"
#include "InputFiles.hpp"
#include "log_macros.h"
@@ -35,19 +36,10 @@
fflush(stdout);
}
-void image::ConvertImgToInt8(void* data, const size_t kMaxImageSize)
-{
- auto* tmp_req_data = static_cast<uint8_t *>(data);
- auto* tmp_signed_req_data = static_cast<int8_t *>(data);
-
- for (size_t i = 0; i < kMaxImageSize; i++) {
- tmp_signed_req_data[i] = (int8_t) (
- (int32_t) (tmp_req_data[i]) - 128);
- }
-}
-bool image::PresentInferenceResult(
+
+bool PresentInferenceResult(
hal_platform &platform,
const std::vector<arm::app::ClassificationResult> &results)
{
@@ -93,19 +85,6 @@
return true;
}
-void image::RgbToGrayscale(const uint8_t *srcPtr, uint8_t *dstPtr, const size_t dstImgSz)
-{
- float R=0.299;
- float G=0.587;
- float B=0.114;
- for (size_t i = 0; i < dstImgSz; ++i, srcPtr += 3) {
- uint32_t int_gray = R * (*srcPtr) +
- G * (*(srcPtr + 1)) +
- B * (*(srcPtr + 2));
- *dstPtr++ = int_gray <= std::numeric_limits<uint8_t>::max() ?
- int_gray : std::numeric_limits<uint8_t>::max();
- }
-}
void IncrementAppCtxIfmIdx(arm::app::ApplicationContext& ctx, const std::string& useCase)
{