I want to read a video using pdollar toolbox. I have few video files upon whom I am trying to apply the acfDetect classier. However, I don't get the correct output. On checking, I found that the data of the frame (the matrix) do not match, for Matlab and Octave. The question will be clear with the attached pics. I tried to print the value of the frame and this is what I get:
Matlab output:
Octave output:
As a hit an trial, I saw that multiplying Octave values by 255 (RGB max) gives me an approx to the Matlab values. But when I do so, I get the following error:
> >> runonVideos
processing 11-50-48--11-50-58_resized.mp4 ...
error: rgbConvertMex: For floats all values in I must be smaller than 1.
error: called from
rgbConvert at line 80 column 2
chnsPyramid at line 133 column 2
acfDetect_modified>acfDetectImg at line 74 column 2
acfDetect_modified at line 41 column 19
pedestrianDetection at line 33 column 11
runonVideos at line 8 column 5
Essentially, Matlab gets the same value (0-255) but doesn't give any such error for the function stated here: rgbConvertMex.I am unable to understand where exactly is the problem.
If I am able to get the same value as in Matlab, my problem will be solved to a large extent.
The Octave code is here:
> % Output text file
outFile = fopen(['C:\devwork\matlab\boosted\detection\',videoFname(1:end-4),'_detections.txt'],'w+');
% videoPlayer = vision.VideoPlayer;
vObj = VideoReader('C:\devwork\matlab\boosted\resizedVideos\11-50-48--11-50-58_resized.mp4');
%fprintf vObj;
% videoFwriter = vision.VideoFileWriter('result3_newAnnLdcf+.mp4','FileFormat','MPEG4','FrameRate',vObj.FrameRate);
tic
while hasFrame(vObj)
frame = readFrame(vObj);
%fprintf(frame);
% frame = imresize(frame,0.5);
bbs = acfDetect_modified(frame,detector);
% displayFrame = frame;
bbs = bbs(:,1:4);
bbs = round(bbs);
% if ((bbs(1,:) >= 1152) || (bbs(2,:) >= 648))
% disp('BB exceeds bounds')
% disp(bbs)
% end
% displayFrame = insertShape(displayFrame,'Rectangle',bbs,'LineWidth',2,'Color','red');
fprintf(outFile,'%d ',reshape(bbs,numel(bbs),1));
fprintf(outFile,'\n');
% videoPlayer.step(displayFrame);
% step(videoFwriter,displayFrame);
end
toc
fclose(outFile);
fprintf('done \n');
% release(videoPlayer);
% release(videoFwriter);
end
Edit 1: In Matlab, I tried changing v=v*255 to v=uint8(v) But now I get all values as either 0 or 1.
Edit 2:
Edit 3: As suggested, code line 31 in Octace was changed to:v=uint8(v*255);
This does give result in integers but they are still not same as that of Matlab. I am guessing it must be some issue with my multiplication factor of 255. But this is still not resolved.





uint8. - beakeruint8in Octave after multiplying by 255, it'll probably work. - beakeruint8only transformfloatinto integers. My guess is that the pixels values in the image are between 0 and 1 and when transformed into integers it gives you a matrix of zeros and one. So you need to add the line that multiplies the values by 255. When you load the image, check theminandmaxvalue of your image to verify the range in which the pixels intensity fall into. - Eskapp