回答
一個簡單的方法來產生你的方塊是sum你的圖像向下每列,並尋找總和下降到某個閾值以下(即白色像素下降到該列中給定數字以下)的地方。這會給你列方塊的位置。這些盒子的寬度可能太窄(即數字的一小部分可能會伸出兩側),所以你可以通過索引向量來擴大索引向量,使用小向量的索引向量,並查找大於零。下面是使用上面的你的形象的例子:
rawImage = imread('license_plate.jpg'); %# Load the image
maxValue = double(max(rawImage(:))); %# Find the maximum pixel value
N = 35; %# Threshold number of white pixels
boxIndex = sum(rawImage) < N*maxValue; %# Find columns with fewer white pixels
boxImage = rawImage; %# Initialize the box image
boxImage(:,boxIndex) = 0; %# Set the indexed columns to 0 (black)
dilatedIndex = conv(double(boxIndex),ones(1,5),'same') > 0; %# Dilate the index
dilatedImage = rawImage; %# Initialize the dilated box image
dilatedImage(:,dilatedIndex) = 0; %# Set the indexed columns to 0 (black)
%# Display the results:
subplot(3,1,1);
imshow(rawImage);
title('Raw image');
subplot(3,1,2);
imshow(boxImage);
title('Boxes placed over numbers');
subplot(3,1,3);
imshow(dilatedImage);
title('Dilated boxes placed over numbers');
注:上面所做的閾值佔可能性黑與白的圖像可能是雙精度型(帶的值或者0或1),邏輯(也具有0或1的值)或無符號的8位整數(值爲0或255)。您所要做的就是將N
設置爲白色像素的數量,以用作標識包含部分數字的列的閾值。
@gnovice感謝您的回覆,但它沒有奏效。我所得到的只是帶有標題的新圖。有什麼建議麼? – 2011-04-05 16:41:36
@Michael:如果你使用你的文章中的相同圖像(即右擊,保存,然後加載和處理它),它會工作嗎? – gnovice 2011-04-05 16:51:29
@gnovice你說得對。我如何才能使它具有普遍性,以適應所有圖像。如果有可能... – 2011-04-05 17:20:14
假設你有框周圍的字母 - 它給你的整體角度
關閉圖像分解成一維(可能有助於使邊界框是水平的,以第一次將其旋轉)
然後尋找這個1d簽名中的字母之間的差距給你數字的位置。如果您知道板的位數和格式,它會有所幫助。
- 1. 識別圖像中的數字(Matlab)
- 2. 圖像分割(MATLAB)
- 3. 圖像分割Matlab的
- 4. MATLAB中的圖像分割算法
- 5. matlab中的圖像處理(分割)
- 6. 積分分段函數的matlab
- 7. Matlab Axislabel在圖像中部分達到
- 8. MATLAB vs Simulink在數字圖像處理?
- 9. Matlab表中的子字段
- 10. 從MATLAB中保存圖像的圖像
- 11. MATLAB:從二進制圖像中分割單個字母
- 12. matlab和圖像中的重塑函數
- 13. MATLAB:過濾出圖像的一部分
- 14. 肝臟的Matlab圖像分割
- 15. 圖像的Matlab切出部分
- 16. 用MATLAB獲取圖像的一部分
- 17. matlab - 圖像中的亮度
- 18. MATLAB中的「捕捉圖像」
- 19. matlab中的衛星圖像
- 20. 如何在matlab中查找圖像分割部分的厚度?
- 21. 灰度圖像中的MATLAB分類分割,陰影不變
- 22. MATLAB函數圖像過濾
- 23. 如何從matlab中的圖像中剪切選定的部分?
- 24. 使用MATLAB分離圖像顏色
- 25. 使用MATLAB分割圖像處理
- 26. Matlab圖像分割和圓形識別
- 27. 在Matlab中的數字和繪圖
- 28. 着色分段圖像
- 29. MATLAB:圖像
- 30. matlab中心電圖像的直方圖
建議標題更改 - 「圖像中的段數字」? – 2011-04-04 22:50:02