您现在的位置:首页 >> 图像处理 >> 内容

基于形态学处理算法的迷宫路线搜索matlab仿真

时间:2022/12/29 17:29:42 点击:

  核心提示:A161,包括程序操作录像...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/Y52bkpls

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览



3.算法概述

       这个课题适用于“完美迷宫”。 不使用搜索或优化方法,仅使用形态学和标准图像处理方法。 仅针对彩色和单色图像进行了测试。 包括演示迷宫,但您可以指定自己的迷宫图像。 迷宫图像应该在浅色背景上有深色墙壁。 迷宫可能会被白色包围,或者直接走到图像的边缘,并将外墙作为图像的外边界。

4.部分源码

[labeledImage numberOfWalls] = bwlabel(binaryImage, 4);     % Label each blob so we can make measurements of it

coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels

% Display the results of this step.

subplot(2, 2, 3);

imshow(coloredLabels); 

caption = sprintf('Labeled image of the %d walls, each a different color', numberOfWalls);

title(caption, 'FontSize', fontSize);

if numberOfWalls ~= 2

message = sprintf('This is not a "perfect maze" with just 2 walls.\nThis maze appears to have %d walls,\nso you may get unexpected results.', numberOfWalls);

uiwait(msgbox(message));

end

binaryImage2 = (labeledImage == 1);

% Display the results of this step.

subplot(2, 2, 4);

imshow(binaryImage2, []);

title('One of the walls', 'FontSize', fontSize);

% Dilate the walls by a few pixels

dilationAmount = 7; % Number of pixels to dilate and erode.

dilatedImage = imdilate(binaryImage2, ones(dilationAmount));

figure;  % Create another, new figure window.

set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

% Display the results of this step.

subplot(2, 2, 1);

imshow(dilatedImage, []);

title('Dilation of one wall', 'FontSize', fontSize);

filledImage = imfill(dilatedImage, 'holes');

% Display the results of this step.

subplot(2, 2, 2);

imshow(filledImage, []);

title('Now filled to get rid of holes', 'FontSize', fontSize);

%A161

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168