我正在尝试按照本教程http://www.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html使用 Matlab 检测图像中的文本。
作为第一步,本教程使用detectMSERFeatures
检测图像中的文本区域。但是,当我在图像上使用此步骤时,未检测到文本区域。
这是我正在使用的片段:
colorImage = imread('demo.png');
I = rgb2gray(colorImage);
% Detect MSER regions.
[mserRegions] = detectMSERFeatures(I, ...
'RegionAreaRange',[200 8000],'ThresholdDelta',4);
figure
imshow(I)
hold on
plot(mserRegions, 'showPixelList', true,'showEllipses',false)
title('MSER regions')
hold off
这是原始图像
这是第一步之后的图像
[![在此处输入图像描述][2]][2]
更新
我玩过参数,但似乎没有一个能完美地检测到文本区域。有没有比调整数字更好的方法来实现这一点?调整参数不适用于我可能拥有的大量图像。
我尝试过的一些参数及其结果:
[mserRegions] = detectMSERFeatures(I, ...
'RegionAreaRange',[30 100],'ThresholdDelta',12);
[mserRegions] = detectMSERFeatures(I, ...
'RegionAreaRange',[30 600],'ThresholdDelta',12);