修复模板匹配位深的小bug

This commit is contained in:
zjc-zjc-123 2024-11-28 14:10:05 +08:00
parent 55b20ed64d
commit fd368e169b
3 changed files with 5 additions and 5 deletions

View File

@ -147,7 +147,7 @@ void TemplateMatcher::findModels(const MIL_ID& inputImage,MIL_ID& outputImage)
// Create a binary image buffer
MbufAlloc2d(MilSystem, MbufInquire(inputImage, M_SIZE_X, M_NULL),
MbufInquire(inputImage, M_SIZE_Y, M_NULL), 8 + M_UNSIGNED,
MbufInquire(inputImage, M_SIZE_Y, M_NULL), 1 + M_UNSIGNED,
M_IMAGE + M_PROC, &outputImage);
// Initialize the binary image to black
MbufClear(outputImage, 0);
@ -252,12 +252,12 @@ void TemplateMatcher::predict(const MIL_ID &inputImage, MIL_ID &outputImage, con
if (do_resize) {
MIL_ID detection_resize, output_image_unresize;
MbufAlloc2d(MilSystem, MbufInquire(detection_result, M_SIZE_X, M_NULL)/2,
MbufInquire(detection_result, M_SIZE_Y, M_NULL)/2, 1 + M_UNSIGNED,
MbufInquire(detection_result, M_SIZE_Y, M_NULL)/2, 8 + M_UNSIGNED,
M_IMAGE + M_PROC, &detection_resize);
MimResize(detection_result,detection_resize,0.5,0.5,M_DEFAULT);
this->FindTemplates(detection_resize,output_image_unresize, params);
MbufAlloc2d(MilSystem, MbufInquire(detection_result, M_SIZE_X, M_NULL),
MbufInquire(detection_result, M_SIZE_Y, M_NULL), 1 + M_UNSIGNED,
MbufInquire(detection_result, M_SIZE_Y, M_NULL), 8 + M_UNSIGNED,
M_IMAGE + M_PROC, &outputImage);
MimResize(output_image_unresize,outputImage,2,2,M_DEFAULT);
MbufFree(detection_result);

View File

@ -54,7 +54,7 @@ void LoadImagesFromFolder(const std::string& folderPath)
{
pre_process(MilImage, detection_result, params);
MbufAlloc2d(MilSystem, MbufInquire(detection_result, M_SIZE_X, M_NULL)/2,
MbufInquire(detection_result, M_SIZE_Y, M_NULL)/2, 1 + M_UNSIGNED,
MbufInquire(detection_result, M_SIZE_Y, M_NULL)/2, 8 + M_UNSIGNED,
M_IMAGE + M_PROC, &detection_resize);
MimResize(detection_result,detection_resize,0.5,0.5,M_DEFAULT);
matcher.FindTemplates(detection_resize,output_Image,params);

View File

@ -18,7 +18,7 @@
#define IMAGE_DIR MIL_TEXT(".\\test_imgs\\cotton_image_new") // 文件夹路径
#define run_high_sat true;
#define run_templating false;
#define run_templating true;
#define run_deep_learning true;
MIL_ID MilApplication, MilSystem, MilDisplay;