基于MSER的高速公路交通标志提取matlab仿真

news2024/9/21 12:10:39

目录

1.算法描述

2.仿真效果预览

3.MATLAB核心程序

4.完整MATLAB


1.算法描述

       自然场景下的文本检测是自然场景图像信息提取的基础,在车牌识别、实时翻译、图像检索等领域具有广泛的应用价值及研究意义。基于连通区域的方法是自然场景文本检测中最为常见的方法,其中最大稳定极值区域(Maximally Stable Extremal Regions,MSER)算法和颜色聚类算法都有着广泛的应用。

MSER = Maximally Stable Extremal Regions
最大极值稳定区
业界认为是性能最好的仿射不变区域,MSER是当使用不同的灰度阈值对图像进行二值化时得到的最稳定的区域,特点:
1.对于图像灰度的仿射变化具有不变性
2.稳定性,区域的支持集相对灰度变化稳定
3.可以检测不同精细程度的区域

       交通标志检测和识别系统的关键在于交通标志候选区域的分割、交通标志的特征提取和分类器的设计。交通标志背景复杂,很难从其背景中将其分割出来,并且由于交通标志一般放在户外场景中,受外界原因(光照,损坏、遮挡等)影响较大,这就大大加大了交通标志检测的难度。交通标志本身种类繁多,相同形状的交通标志根据其象形图案的不同,意义千差万别,造成识别阶段准确率低。

       交通标志路牌中的每个交通标志信息均可以用一个区域特征来表示,最大稳定极值区域(Maximally Stable Extremal Regions,简称 MSER)就是一种很好的区域检测算子,它是由 Matas等人]提出的一种局部区域仿射不变特征的区域检查算子。该算子已用于大规模图像索、识别、以及跟踪,相比其他区域算子,该算子对图像灰度具有仿射变换不变性和多尺度检测目标的优点,能够很好的提取交通标志有效区域,有助于交通标志的定位及分割。MSER算法中,其极值区域的定义为和图像的阈值相关,设定好灰度阈值后,在图像中的某个区域能够成为极值区域的条件是无法再找到一个不大于所设定的灰度阈值的像素点去扩大当前区域。在所有的二值化图中,每个连通区域都是一个极值区域,即使是一个黑点,也是一个极值区域。任选两个极值区域,只有两种关系,一种是没有交集,一种是包含。每个二值图像上可以有多个极值区域,原始灰度图像中每个像素点可能对应多个二值图像上的极值区域。

      MSER算法中,其最大稳定极值区域的定义为极值区域随着设置的灰度阈值的增大而逐渐“长大”。这样的一组极值区域由小到大是相互嵌套的关系,分别用来表示这一系列相互嵌套的极值区域序列。如果为MSER,则其满足如下条件:

 

   变量表示的是像素差值。由于 Q 是一个像素点的集合,所以绝对值代表的是该集合的基数,表示这个极值区域的面积。需先要先找到所有的极值区域,然后通过上面的“稳定标准”来确定最终的 MSER。

MSER = Maximally Stable Extremal Regions

业界认为是性能最好的仿射不变区域,MSER是当使用不同的灰度阈值对图像进行二值化时得到的最稳定的区域,特点:

1.对于图像灰度的仿射变化具有不变性

2.稳定性,区域的支持集相对灰度变化稳定

3.可以检测不同精细程度的区域

MSER提取过程

1.使用一系列灰度阈值对图像进行二值化处理

2.对于每个阈值得到的二值图像,得到相应的黑色区域与白色区域

3.在比较宽的灰度阈值范围内保持形状稳定的区域就是MSERs

4.评判标准: dA/dt

A: 二值图像区域面积,t: 灰度阈值

2.仿真效果预览

matlab2022a仿真如下:

 

 

3.MATLAB核心程序

% 1) Select input image to process if it's gray or segmented and create a single
% row vector with the image
switch usage
  case 'segmented'
    % Simple segmentation by color threshold
    img_seg = f_seg(img, color_threshold, color_of_interest, ratio);
    subplot(2,2,1);
    imshow(img);
    title(['Original Image (' num2str(width) 'x' num2str(height) ')']);
    subplot(2,2,2);
    imshow(img_seg);
    title(['Segmented img ( Color filt:' color_of_interest ' Threshold:' ...
                                                 num2str(color_threshold) ')']);
    i = 1;
    for y=1:height
      for x=1:width
        if img_seg(y,x) == 0
          img_scan(i,1) = 1;
        else
          img_scan(i,1) = img_seg(y,x);
        end
        i=i+1;
      end
    end
    img_selected = img_seg;
  case 'gray'
    % Image converted in gray scale
    img_grey = rgb2gray(img);
    subplot(2,2,1);
    imshow(img);
    title(['Original Image (' num2str(width) 'x' num2str(height) ')']);
    subplot(2,2,2);
    imshow(img_grey);
    title(['Gray Image (' num2str(size(img_grey,2)) 'x' ...
                                                num2str(size(img_grey,1)) ')']);
    i = 1;
    for y=1:height
      for x=1:width
        if img_grey(y,x) == 0
          img_scan(i,1) = 1;
        else
          img_scan(i,1) = img_grey(y,x);
        end
        i=i+1;
      end
    end
    img_selected = img_grey;
end
 
% 2) Create the bin mask with accessed pixels
bin_mask_access = zeros(total_pixels_img,1);
 
% 3) Initialize control variables
priority = 256;                           % Variable that defines the smallest
                                          % 'dark' pixel
current_pixel = 1;
current_edge  = 0;
current_level = img_scan(current_pixel);
bin_mask_access(current_pixel) = 1;
index_regions = 0;
g_index_stack = 0;
 
% Create the LIFO for the 256 gray leves
for i=1:256
  boundary_pixels(i) = CStack();
end
 
% Insert into the tree the most 'bright' pixel that equivalent to 256
g_index_stack = g_index_stack + 1;
index_regions = index_regions + 1;
region_stack(index_regions).level = 256;
region_stack(index_regions).area = 0;
region_stack(index_regions).mom(1) = 0;
region_stack(index_regions).mom(2) = 0;
region_stack(index_regions).mom(3) = 0;
region_stack(index_regions).mom(4) = 0;
region_stack(index_regions).mom(5) = 0;
region_stack(index_regions).variation_mser = 999999;
region_stack(index_regions).stable = 0;
region_stack(index_regions).parent = 0;
region_stack(index_regions).child = 0;
region_stack(index_regions).next = 0;
% This is an auxiliary vector (LIFO) to store the regions pushed and not process
% ed by the function 'process_stack' yet, which defines the parent and child nod
% es. In normal behavior this must inflate and deinflate during the image proces
% sing
stack(g_index_stack).node = index_regions;
 
% Each region_stack has a correspondent rect that represents the rectangle assoc
% iated with that region, it facilitates in the later step
rect(index_regions).top = Inf;
rect(index_regions).bottom = 0;
rect(index_regions).left = Inf;
rect(index_regions).right = 0;
rect(index_regions).draw = 1;
 
% Insert into the tree the first region for the first pixel level in the image
g_index_stack = g_index_stack + 1;
index_regions = index_regions + 1;
region_stack(index_regions).level = current_level;
region_stack(index_regions).area = 0;
region_stack(index_regions).mom(1) = 0;
region_stack(index_regions).mom(2) = 0;
region_stack(index_regions).mom(3) = 0;
region_stack(index_regions).mom(4) = 0;
region_stack(index_regions).mom(5) = 0;
region_stack(index_regions).variation_mser = 999999;
region_stack(index_regions).stable = 0;
region_stack(index_regions).parent = 0;
region_stack(index_regions).child = 0;
region_stack(index_regions).next = 0;
stack(g_index_stack).node = index_regions;
 
rect(index_regions).top = Inf;
rect(index_regions).bottom = 0;
rect(index_regions).left = Inf;
rect(index_regions).right = 0;
rect(index_regions).draw = 1;
 
% 4) Run the main algorithm that will scan all pixels inside the image
gCounter = 0;
done = 0;
while (done == 0)
  gCounter = gCounter+1; % ...it'll always be the total_pixels_img
 
  % While loop to scan all edges of the pixel in analisys
  while current_edge < 4
    % ...get the neighbor pixel according to correspondent edge in the BIG row v
    % ector that contains all pixels
    neighbor_pixel = f_neighbor_pixel(current_pixel,current_edge,width,height);
    if (bin_mask_access(neighbor_pixel) == 0)
      neighbor_level = img_scan(neighbor_pixel,1);
      bin_mask_access(neighbor_pixel) = 1;
      % If the neighbor pixel has a 'lowest (black)' level than the current one,
      % let push a new region and define as our new current pixel
      if (neighbor_level < current_level)
        boundary_pixels(current_level).push(bitor(bitshift(current_pixel,4), ...
                                                             (current_edge+1)));
        % ..always define priority as the 'darkest' pixel founded, because we'll
        % search for that pixel in the boundary stack after if we do not find an
        % y pixel lowest (black) in the edges
        if (current_level < priority)
          priority = current_level;
        end
				current_pixel = neighbor_pixel;
				current_edge = 0;
				current_level = neighbor_level;
 
        % Push a new region with the new 'darkest' pixel founded
        index_regions = index_regions + 1;
        region_stack(index_regions).level = current_level;
        region_stack(index_regions).area = 0;
        region_stack(index_regions).mom(1) = 0;
        region_stack(index_regions).mom(2) = 0;
        region_stack(index_regions).mom(3) = 0;
        region_stack(index_regions).mom(4) = 0;
        region_stack(index_regions).mom(5) = 0;
        region_stack(index_regions).variation_mser = 999999;
        region_stack(index_regions).stable = 0;
        region_stack(index_regions).parent = 0;
        region_stack(index_regions).child = 0;
        region_stack(index_regions).next = 0;
        g_index_stack = g_index_stack + 1;
        stack(g_index_stack).node = index_regions;
        % ..and its rectangle combined
        rect(index_regions).top = Inf;
        rect(index_regions).bottom = 0;
        rect(index_regions).left = Inf;
        rect(index_regions).right = 0;
        rect(index_regions).draw = 1;
        continue;
      end
 
      % If the current pixel is the 'lowest (black)', store the neighboor for la
      % ter search iteration
      boundary_pixels(neighbor_level).push(bitor(bitshift(neighbor_pixel,4),0));
      if (neighbor_level < priority)
        priority = neighbor_level;
      end
    end
    current_edge = current_edge + 1;
  end
A86

4.完整MATLAB

V

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/61656.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

[附源码]Python计算机毕业设计SSM街舞公司管理系统(程序+LW)

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

Java Script 内置对象(三) --------- Array 对象

判断是否为数组有两种方式&#xff0c;instanceof 和 Array.isArray( 参数 )&#xff0c;两者判断方法均为如果是数组则返回 true&#xff0c;不是数组则返回 **false&#xff0c;**其中第二个方法为H5新增加的方法 var arr[]; var obj{}; console.log(arr instanceof Arra…

微服务入门案例

boot与cloud版本 springboot:提供了快速开发微服务的能力 springcloud提供了微服务治理的能力&#xff08;服务注册与发现、服务降级、限流、熔断、网关、负载均衡、配置中心...&#xff09;&#xff0c;为微服务开发提供了全家桶服务 springboot的版本查看地址&#xff1a;Spr…

云原生之Docker简介和环境准备

Docker简介一、主机环境二、Docker 安装三、Docker简介3.1、Docker解决的问题3.2、Docker技术边界3.3、Docker带来的改变3.4、Docker和虚拟机的区别3.5、Docker 架构图3.6、直观感受client请求server总结后言一、主机环境 &#xff08;1&#xff09;ubuntu-20.04.4-live-serve…

【torch.utils.data】 Dataset和Dataloader的解读和使用

文章目录torch.utils.data前言DatasetDataloader实践参考torch.utils.data 前言 Pytorch中的 torch.utils.data 提供了两个抽象类&#xff1a;Dataset 和 Dataloader。Dataset 允许你自定义自己的数据集&#xff0c;用来存储样本及其对应的标签。而 Dataloader 则是在 Datase…

LTspice XVII > Transformer 变压器仿真

目录 第①步设置 第②步设置 第③步设置 第④步设置 输出结果 最近在看“无线电基础电路实作修订版 [&#xff08;美&#xff09;西尔弗 著] 2014年版”这本书&#xff0c;打算好好修炼下无线电方面的基础知识&#xff0c;让自己更加牛逼一些&#xff0c;工作中偶尔可以装…

指标与标签的区别?

概述 在公司数据建设过程中&#xff0c;经常会使用和提到指标和标签&#xff0c;但是很多小伙伴对于两者的区别确不能讲清楚。实际上标签与指标一样&#xff0c;是理解数据的两种方式&#xff0c;在赋能业务上&#xff0c;两者同样重要。接下来将结合自身的理解&#xff0c;从…

Java项目:SSM共享汽车租赁平台

作者主页&#xff1a;源码空间站2022 简介&#xff1a;Java领域优质创作者、Java项目、学习资料、技术互助 文末获取源码 项目介绍 本项目分为前后台&#xff0c;前台为普通用户登录&#xff0c;后台为管理员登录&#xff1b; 管理员角色包含以下功能&#xff1a; 管理员登录…

ElementUI组件-日期时间控件设置禁用日期

ElementUI组件-日期时间控件禁用指定日期 主要属性 查看官网&#xff0c;可以看到有个叫做picker-options的组件属性&#xff0c;没错&#xff0c;就是借助他来完成禁用指定日期的操作&#xff0c;如下 该属性值传入的是一个对象&#xff0c;对于时间选择器、日期选择器、日…

[阶段4 企业开发进阶] 3. 消息队列--RabbitMQ

文章目录1 消息队列1.1 MQ的概念基本介绍使用原因MQ分类如何选择1.2 RabbitMQRabbitMQ核心工作原理安装教程1 消息队列 1.1 MQ的概念 基本介绍 MQ本质是个队列&#xff0c;FIFO 先入先出&#xff0c;只不过队列中存放的内容是 message 而已是一种跨进程的通信机制&#xff0…

[附源码]计算机毕业设计校刊投稿系统Springboot程序

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

Py之removebg:removebg的简介、安装、使用方法之详细攻略

Py之removebg&#xff1a;removebg的简介、安装、使用方法之详细攻略 目录 removebg的简介 1、官网注册获取APIKey removebg的安装 removebg的使用方法 1、直接调用并实现抠图 2、更多案例 removebg的简介 Remove Image Background&#xff0c;是一款不用PS就完成抠图的强…

每日挠头算法题(十五)螺旋矩阵II

“强大方能侠义” ------持续更新Blue Bridge杯入门系列算法实例-------- 如果你也喜欢Java和算法&#xff0c;欢迎订阅专栏共同学习交流&#xff01; 你的点赞、关注、评论、是我创作的动力&#xff01; -------希望我的文章对你有所帮助-------- 前言&#xff1a;最近可能…

【Python自学笔记】报错No module Named Wandb

【Python自学笔记】已经装了wandb&#xff0c;还报错No module Named Wandb 方法1.重启cmd和jupyter notebook 直接把窗口和cmd页面全关了&#xff0c;重新打开&#xff0c;再次运行安装和启动代码&#xff1a; !pip install wandbimport wandb wandb.init(project"你自…

【Matlab】一、解常微分方程ODE

文章目录求解常微分方程 ODE&#xff08;1&#xff09;求解解析解&#xff08;2&#xff09;求解数值解求解常微分方程 ODE ​ 在matlab中&#xff0c;我们可以求解常微分方程的解析解&#xff0c;和数值解&#xff0c;一般使用dsolve来求解常微分方程的解析解&#xff0c;使用…

jsp 上传文件及实体信息,ajax post 请求(formdata)报错400<======>前后端代码示例

Content-Type最常见的几种类型&#xff1a; 通常&#xff0c;没有声明&#xff0c;默认application/x-www-form-urlencoded application/x-www-form-urlencoded form表单默认的数据格式&#xff0c;提交的数据形式 key1val1&key2val2&#xff08;参数少&#xff09; mu…

[附源码]计算机毕业设计线上社区管理系统Springboot程序

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

〖全域运营实战白宝书 - 高转化文案速成篇③〗- 高打开率标题型文案的10大黄金法则

大家好&#xff0c;我是 哈士奇 &#xff0c;一位工作了十年的"技术混子"&#xff0c; 致力于为开发者赋能的UP主, 目前正在运营着 TFS_CLUB社区。 &#x1f4ac; 人生格言&#xff1a;优于别人,并不高贵,真正的高贵应该是优于过去的自己。&#x1f4ac; &#x1f4e…

第一期 | 整洁,从桌面开始

文章目录前言一、主要内容介绍二、文件分类&#xff0c;整理你的桌面1.网格对齐图标&#xff0c;取消自动排列2.保持工作状态&#xff0c;提取近期文件3.用好排序&#xff0c;让文件一目了然4.分类整理&#xff0c;让文件听你的话5.按照实际情况作调整三、合理归档&#xff0c;…

[附源码]JAVA毕业设计框架的企业机械设备智能管理系统的设计与实现(系统+LW)

[附源码]JAVA毕业设计框架的企业机械设备智能管理系统的设计与实现&#xff08;系统LW&#xff09; 目运行 环境项配置&#xff1a; Jdk1.8 Tomcat8.5 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支…