通过分割受损的叶子自动检测昆虫捕食(matlab代码实现)

 👨‍🎓个人主页:研学社的博客 

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🌈3 Matlab代码实现

🎉4 参考文献


💥1 概述

在农业领域开展的活动响应高附加值业务,在谷物,油籽,观赏和药用植物以及绿色蔬菜的生产中具有重要的经济意义。2019/2020 年,世界大豆产量达到 3.3659 亿公吨 (Mmt),移动 312 亿美元,仅美国的产量为 96.67 百万吨[1]。虽然低于 2018/2019 年的产量,但玉米产量达到 1,116.2 百万吨,平均价格约为每吨 美元362美元,是自 2015 年 8 月以来的最高水平[2]。离心糖产量达到166.17 Mmt,其中巴西在过去五年中一直领先于世界产量,产量超过29.92 Mmt[3]。

在谷物、油籽和新鲜落叶水果生产的带动下,粮食产量达到了新的高度,超过了前几年的产量,并估计未来几年将创下新纪录。从这个意义上说,技术进步对于降低成本、提高质量和生产力至关重要。在本文中,我们提出了一种利用几何叶子特性和数字图像处理技术构建图像模型的植物叶片捕食的新方法。与其他方法不同,我们的方法检测并突出显示被昆虫攻击的叶子区域,并分割昆虫叮咬的轮廓。我们评估了我们的提案,考虑了世界市场的12种关键作物,事实证明,即使在存在噪声、图像比例和旋转的情况下,它也是有效的。此外,无论植物种类如何,它都能精确地识别昆虫捕食区域90%在蓝莓、玉米、马铃薯和大豆叶中。因此,该提案引入了一种自动叶片分析的新方法,并有助于减少识别害虫发生的人力。

📚2 运行结果

 

 

 

 

 

 

 

 

 以上为部分结果图:

部分代码:

%% Load images
template_images = load_images('images/template_images', 'png');
test_images = load_images('images/test_images', 'png');

%% PREPROCESSING
% binarize model data
threshold = 5;
qtty_modelData = length(template_images);
template_images_mask = cell(qtty_modelData,1);

for i=1:qtty_modelData
    template_images_mask{i} = binarize_image(template_images{i}, threshold);
    template_images{i} = double(template_images{i}) .* template_images_mask{i};
end

% prepare leaf models
leaf_models = cell(qtty_modelData,1);

for i=1:qtty_modelData
    [~,~, ch] = size(template_images{i});

    l_model...
    = build_leaf_models(template_images{i});
    leaf_models(i) = { l_model };    
end

%% binarize leaf models
leaf_models_mask = cell(qtty_modelData,1);
for i=1:qtty_modelData
    leaf_model_mask = leaf_models{i};
    leaf_model_mask = logical(leaf_model_mask(:,:,2));
    leaf_model_mask_hull = bwconvhull(leaf_model_mask);
    leaf_models_mask{i} = leaf_model_mask_hull;
end

%% binarize test data
threshold = 0;
qtty_testImages = length(test_images);
test_images_mask = cell(qtty_testImages,1);
for i=1:qtty_testImages
    test_images_mask{i} = binarize_image(test_images{i}, threshold);
    test_images{i} = double(test_images{i}) .* test_images_mask{i};
end

%% Apply synthetic defoliation
id = 1;
img = test_images{id};
img_mask = test_images_mask{id};
min_defoliation = 16;
max_defoliation = 31;

[defoliated_leaf_testData, bite_signature_testData, img_out, defoliation_level, damaged_areas] = ...
    synthetic_defoliation(img,img_mask,'caterpillar_bite', min_defoliation, max_defoliation, 6, 50, 1);

figure; imagesc(uint8(img)); title('Original Image');
figure; imagesc(uint8(defoliated_leaf_testData)); colormap gray
title(['Synthetic defoliation: ', num2str(defoliation_level), '% damage']);

%% binarize defoliated leaf test data
defoliated_leaf_testData_mask = binarize_image(defoliated_leaf_testData,threshold);

%% Compute defoliation
[damaged_leaf_out, healthy_leaf_out, damaged_areas_out, bite_signatures_out] = ...
        detect_leaf(defoliated_leaf_testData, img, damaged_areas, bite_signature_testData);

% calc defoliation using healthy leaf mask
healthy_leaf_out_mask = logical(healthy_leaf_out(:,:,2));
defoliation_level_ALL(1) = (sum(damaged_areas_out(:) * 100) / sum(healthy_leaf_out_mask(:)));

% prepare the damaged leaf mask
damaged_leaf_out_mask = logical(damaged_leaf_out(:,:,2));
damaged_leaf_out_mask_hull = bwconvhull(damaged_leaf_out_mask);

% IMAGE MATCHING
% compare the damaged leaf with the leaf models using jaccard
jac_result = zeros(length(leaf_models_mask), 1);
for j=1:length(leaf_models_mask)
    jac_result(j) = jaccard(leaf_models_mask{j}, damaged_leaf_out_mask_hull); 
end
[jac_max, jac_max_idx] = max(jac_result);


%% DEFOLIATION ESTIMATE
leaf_model = leaf_models{jac_max_idx};
leaf_model_mask = logical(leaf_model(:,:,2));
diff = leaf_model_mask & ~damaged_leaf_out_mask;
defoliation_level_ALL(2) = (sum(diff(:) * 100) / (sum(leaf_model_mask(:))));

% evaluate the damaged area
jac = jaccard(damaged_areas_out, diff);
dic = dice(damaged_areas_out, diff);

% keep evaluating the damaged area
[confusionMatrix_pixels, resultRates_pixels, resultSDT, overlap] =...
    leaf_evaluation(damaged_leaf_out_mask, healthy_leaf_out_mask);
%%
fprintf('#### DEFOLIATION ESTIMATE #### \n')

fprintf('Actual Damage (GT): %1.4f\nDefoliation Estimate (DE) Index: %1.4f\n',...
    defoliation_level_ALL(1), defoliation_level_ALL(2));

fprintf('Jaccard Index: %1.4f\nDice Index: %1.4f\n', jac, dic)

%% Show the results
figure; imshowpair(uint8(leaf_model), uint8(damaged_leaf_out));
title('Leaf model and Damaged leaf');
%%
B = imoverlay(uint8(damaged_leaf_out), diff, [1 0 0]);
figure; imshow(uint8(B));
title('Damaged areas');

🌈3 Matlab代码实现

🎉4 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]G. D. Silva Vieira, N. Maria de Sousa, B. Rocha, A. U. Fonseca and F. Soares, "A Method for the Detection and Reconstruction of Foliar Damage caused by Predatory Insects," 2021 IEEE 45th Annual Computers, Software, and Applications Conference (COMPSAC), 2021, pp. 1502-1507, doi: 10.1109/COMPSAC51774.2021.00223. 

[2]Automatic detection of insect predation through the segmentation of damaged leaves

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

荔枝科研社

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值