Info

This question is closed. Reopen it to edit or answer.

HOG features visualization Problem

1 view (last 30 days)
Algorithms Analyst
Algorithms Analyst on 18 Jan 2013
Hi everyone
I am visualizing the hog features but geting an error here is my sorce code for it
clc
close all
obj = VideoReader('campus.avi');
height = obj.Height;
width = obj.Width;
frames = obj.NumberOfFrames;
cellsize = 8;
nbins = 9;
alpha=0.05;
threshold=0.005;
%read one frame at a time
for f = 1:frames
I = read(obj, f);
figure(1);subplot(2,2,1);imshow(I);title('Input Video Sequence/Frames');
H = hog(single(I), cellsize, nbins);
V = hogDraw(H, 25);
J=imresize(V,0.30);
subplot(2,2,2);imshow(J);title('Histograms of Oriented Gradient');
% visualizeHOG(J);
% %HOG Visualizations % %make Positive HoG Weights [Rows Cols Colors]=size(H); bin1=zeros(Cols,Cols); bin1(:,round(Cols/2):round(Cols/2)+1)=1; bin=zeros([size(bin1) 9]); bin(:,:,1)=bin1; for i=2:9 bin(:,:,i)=imrotate(bin1,-(i+1)*20,'crop'); end s=size(Rows); Rows(Rows < 0) = 0; image = zeros(Cols*s(1), Cols*s(2)); for q = 1:s(1) iis = (q-1)*Cols+1:q*Cols; for j = 1:s(2) jjs = (j-1)*Cols+1:j*Cols; for k = 1:9 image(iis,jjs) = image(iis,jjs) + bin(:,:,k)*Rows(i,j,k);
subplot(2,2,3);imshow(image);title('HOG Visualization');
end
end
end
subplot(2,2,4);imshow(im2bw(J));title('HOG Visualization');
end
bt gettind an error which is here below.
??? Index exceeds matrix dimensions.
Error in ==> seonhosourcecode at 39 image(iis,jjs) = image(iis,jjs) + bin(:,:,k)*Rows(i,j,k);
  2 Comments
Daniel Shub
Daniel Shub on 18 Jan 2013
What are the type, size and values of image, bin, Rows, iis, jjs, k, i, j when the error happens?
Algorithms Analyst
Algorithms Analyst on 18 Jan 2013
size of HOG image is H=36x44x36 bin=9; size(iis)=1by44(colum vector) size(jjs)-1x44(colum vector)
size(k)=1 1 size(i)=1 1 size(j)=1 1 value of bin is =9 value of j is 1:s(2) value of i=2:9 value of k is 1:9

Answers (0)

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!