MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在Matlab中执行字符分割 (https://www.labfans.com/bbs/showthread.php?t=26597)

poster 2019-12-14 20:13

如何在Matlab中执行字符分割
 
我有车牌图像,我想一一削减数字。

任何人都有一个简单的想法如何执行它?

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

任何解释都会有所帮助

提前致谢。



[B]回答:[/B]

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

% This is a program for extracting objects from an image. Written for vehicle number plate segmentation and extraction % Authors : Jeny Rajan, Chandrashekar PS % 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 = [rc]; [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,[]);

[url=https://stackoverflow.com/questions/5305712]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 22:43

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.