gusucode.com > matlab程序语言实现的水准网平差程序,使用于测绘人员 > 一种基于极大值稳定区域的文本定位方法matlab源码程序/毕业设计/代码/SVM_filter.m

    function [mserboxes,mserStats]=SVM_filter(mserboxes,mserStats,grayImage)

load svmStruct

broder=[mserboxes.BoundingBox];

for i=1:numel(mserStats)
    if mserboxes(i).BoundingBox==[0,0,0,0];
    else
        leftx=broder((i-1)*4+1);
        lefty=broder((i-1)*4+2);
        width=broder((i-1)*4+3);
        height=broder((i-1)*4+4);
        im=imcrop(grayImage,[leftx,lefty,width,height]);

        im=imresize(im,[64,64])

        %hogt =hogcalculator(im);
        [hogt,hogVisualization] = extractHOGFeatures(im);  
        classes = svmclassify(svmStruct,hogt);%classes的值即为分类结果
        if classes==1
        else
            mserboxes(i).BoundingBox=[0,0,0,0];
            mserboxes(i).Count=0;
        end
    end
end