You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've re-implemented HOGPicture to be much faster, using a single matrix multiplication.
I think this should be in the main branch, and I don't know what would happen if I simply fork the project as is the default behavior;
So check it out - it's really useful (just copy & paste instead of the original code...)
function im = HOGpicture(w, bs)
%NOTE(TJM): I fixed a visualization bug which would sometimes show
%funky artifacts because pedro's version shows only the orientations
%facing one way. On synthetic images of squares this could be
%seen. The simple fix is to scan over 18 orientations not 9 when
%creating the histogram pics.
% Modified to vectorized version by Amir Rosenfeld, July 31st, 2012
if ~exist('bs','var')
bs = 20;
end
% HOGpicture(w, bs)
% Make picture of positive HOG weights.
% construct a "glyph" for each orientaion
s = size(w);
w(w<0) = 0;
bim1 = zeros(bs, bs);
bim1(:,round(bs/2):round(bs/2)+1) = 1;
bim = zeros([size(bim1) 9]);
bim(:,:,1) = bim1;
for i = 2:9,
bim(:,:,i) = imrotate(bim1, -(i-1)*20, 'crop');
end
bim = cat(3,bim,bim);
bim_ = reshape(bim,[],18);
B = im2col( zeros(bs_s(1), bs_s(2)),[bs bs],'distinct');
w_ = reshape(w(:,:,1:18),[],18);
im = col2im(bim__w_',[bs bs],[bs_s(1), bs*s(2)],'distinct');
end
The text was updated successfully, but these errors were encountered:
Sweet, Let me check this out, and I will push this into the main branch once I make sure it doesn't break anything! Will let you know once the change is made or if I have any questions
Hi,
I've re-implemented HOGPicture to be much faster, using a single matrix multiplication.
I think this should be in the main branch, and I don't know what would happen if I simply fork the project as is the default behavior;
So check it out - it's really useful (just copy & paste instead of the original code...)
function im = HOGpicture(w, bs)
%NOTE(TJM): I fixed a visualization bug which would sometimes show
%funky artifacts because pedro's version shows only the orientations
%facing one way. On synthetic images of squares this could be
%seen. The simple fix is to scan over 18 orientations not 9 when
%creating the histogram pics.
% Modified to vectorized version by Amir Rosenfeld, July 31st, 2012
if ~exist('bs','var')
bs = 20;
end
% HOGpicture(w, bs)
% Make picture of positive HOG weights.
% construct a "glyph" for each orientaion
s = size(w);
w(w<0) = 0;
bim1 = zeros(bs, bs);
bim1(:,round(bs/2):round(bs/2)+1) = 1;
bim = zeros([size(bim1) 9]);
bim(:,:,1) = bim1;
for i = 2:9,
bim(:,:,i) = imrotate(bim1, -(i-1)*20, 'crop');
end
bim = cat(3,bim,bim);
bim_ = reshape(bim,[],18);
B = im2col( zeros(bs_s(1), bs_s(2)),[bs bs],'distinct');
w_ = reshape(w(:,:,1:18),[],18);
im = col2im(bim__w_',[bs bs],[bs_s(1), bs*s(2)],'distinct');
end
The text was updated successfully, but these errors were encountered: