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

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

HOG梯度特征提取

已有 11852 次阅读| 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

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

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 5

    粉丝
  • 0

    好友
  • 1

    获赞
  • 16

    评论
  • 5260

    访问数
关闭

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

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-24 16:44 , Processed in 0.016595 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部