1

ナンバー プレートの画像があり、数字を 1 つずつ切り取りたい。

誰もそれを実行する方法を簡単に考えていますか?

ウェブを検索した後、水平方向と垂直方向のスミアリングの操作を行う方法を見つけましたが、それが何を意味するのか本当にわかりません。

どんな説明でも役に立ちます

前もって感謝します。

4

2 に答える 2

8

regionprops がうまくいくかもしれません。このサンプル ナンバー プレートを取る場合。

サンプル

このような小さなスクリプトを使用して、オブジェクトを切り取ることができます。申し訳ありませんが、すぐにまとめて入力しましたが、アイデアが得られます。

clear all;
close all;
I = imread('plate.jpg');
BW = im2bw(I, 0.9);
BW = ~BW;


stats = regionprops(BW);
for index=1:length(stats)
    if stats(index).Area > 200 && stats(index).BoundingBox(3)*stats(index).BoundingBox(4) < 30000
    x = ceil(stats(index).BoundingBox(1))
    y= ceil(stats(index).BoundingBox(2))
    widthX = floor(stats(index).BoundingBox(3)-1)
    widthY = floor(stats(index).BoundingBox(4)-1)
    subimage(index) = {BW(y:y+widthY,x:x+widthX,:)}; 
    figure, imshow(subimage{index})
    end
end

これは次のような画像を出力します

あ

この

犬

それが本当に手紙かどうかを判断する必要があります。スクリプトは大量の画像 (約 30 または 40) を出力するので注意してください。

于 2011-03-15T00:26:23.157 に答える
1

このコードを試すことができます(私のものではありません)

% 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,[]);
于 2012-02-04T18:42:17.827 に答える