注册 登录
ET创芯网论坛(EETOP) 返回首页

hlayumi的个人空间 http://blog.eetop.cn/hslogic [收藏] [复制] [分享] [RSS]

日志

HOG梯度特征提取

已有 11138 次阅读2018-9-16 21:11 |系统分类:芯片设计

function [gradx, grady] = HOGGradient(G)

% here we defing the mask as [-1, 0, 1], the edge of the image use [-1, 1]
[height, width] = size(G);

gradx = zeros(height, width);
grady = zeros(height, width);

% Process the Image edge
gradx(:,1) = sum(G(:,1:2).*repmat([-1, 1], height, 1), 2);
gradx(:,width) = sum(G(:, width-1:width).*repmat([-1, 1], height, 1), 2);

grady(1,:) = sum(G(1:2, :).*repmat([-1; 1], 1, width), 1);
grady(height,:) = sum(G(height-1:height, :).*repmat([-1; 1], 1, width), 1);

for j=2:height-1
    for i=2:width-1
        tmpx = G(j, i-1:i+1);
        tmpy = G(j-1:j+1, i);
        gradx(j,i) = sum(tmpx.*[-1, 0, 1], 2);
        grady(j,i) = sum(tmpy.*[-1; 0; 1], 1);
    end
end

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

关闭

站长推荐上一条 /1 下一条

QQ ×

关闭
关闭
X

关于我们|联系我们|ET创芯网 ( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2019-6-18 05:42 , Processed in 0.040933 second(s), 8 queries , Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

返回顶部