How to extract character and number only from this image to .txt?
4 ビュー (過去 30 日間)
古いコメントを表示
This is the last figure from erode.
close all;
clear all;
%open original image/rgb image
im = imread('2.jpeg');
imshow(im)
%crop the number plate area
img = imcrop(im, [140 620 610 380]);
f1 = figure;
%convert RGB to grayscale image
imgray = rgb2gray(img);
imshow(imgray)
f2 = figure;
%edge detection from grayscale using sobel method
e = edge(imgray, 'sobel');
imshow(e)
f3 = figure;
%to make the image more thicker
se90 = strel('line',4,90);
se0 = strel('line',4,0);
s = imdilate(e,[se90 se0]);
imshow(s)
f4 = figure;
% Use bwareaopen to delete objects smaller than minSize
g = bwareaopen(s, 150,8);
% g = bwareaopen(g, 1100, 8);
imshow(g)
f5 = figure;
% Using imclearborder to delete object that touch border of the image
h = imclearborder(g);
imshow(h)
f6 = figure;
% to make the image more thinner
se = strel('line',5,45);
f = imerode(h,se);
imshow(f)
f7 = figure;
Please help me about that. Thanks by now for your attention.
0 件のコメント
回答 (1 件)
Kevin Holly
2023 年 1 月 6 日
You could use the optical character recognition (ocr) function that comes with the image processing and computer vision toolbox as such:
img = imread('2.jpeg');
imshow(img)
cropped_img = img(850:950,300:700,:);
imshow(cropped_img)
License = ocr(cropped_img, 'TextLayout', 'line', 'CharacterSet', 'ABCDEFGHIJKLMNOPQRSTUOVWXYZ0123456789')
License.Text
writelines(License.Text,"temp.txt")
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!