如何在Matlab中执行字符分割 [英] how to perform character segmentation in Matlab

查看:110
本文介绍了如何在Matlab中执行字符分割的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有车牌图片,我想一一削减数字.

I have license plate image and I want to cut the numbers one by one.

有人知道如何执行吗?

在网上搜索后,我发现了进行水平和垂直涂抹的方法,但我真的不知道这是什么意思.

after searching the web I found a way by doing the operation of horizontal and vertical smearing, but I really don't know what does it mean.

任何解释都会有所帮助

谢谢.

推荐答案

您可以尝试使用此代码(不是我的)

you can try this code(it's not mine)

% This is a program for extracting objects from an image. Written for vehicle number     plate segmentation and extraction
% Authors : Jeny Rajan, Chandrashekar P S
% U can use attached test image for testing
% input - give the image file name as input. eg :- car3.jpg
clc;
clear all;
k=input('Enter the file name','s'); % input image; color image
im=imread(k);
im1=rgb2gray(im);
im1=medfilt2(im1,[3 3]); %Median filtering the image to remove noise%
BW = edge(im1,'sobel'); %finding edges 
[imx,imy]=size(BW);
msk=[0 0 0 0 0;
 0 1 1 1 0;
 0 1 1 1 0;
 0 1 1 1 0;
 0 0 0 0 0;];
B=conv2(double(BW),double(msk)); %Smoothing  image to reduce the number of connected     components
L = bwlabel(B,8);% Calculating connected components
mx=max(max(L))
% There will be mx connected components.Here U can give a value between 1 and mx for L     or in a loop you can extract all connected components
% If you are using the attached car image, by giving 17,18,19,22,27,28 to L you can     extract the number plate completely.
[r,c] = find(L==17);  
rc = [r c];
[sx sy]=size(rc);
n1=zeros(imx,imy); 
for i=1:sx
x1=rc(i,1);
y1=rc(i,2);
n1(x1,y1)=255;
end % Storing the extracted image in an array
figure,imshow(im);
figure,imshow(im1);
figure,imshow(B);
figure,imshow(n1,[]);

这篇关于如何在Matlab中执行字符分割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆