Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

Commit

Permalink
Correction on dimentions of grabbed frame in Octave
Browse files Browse the repository at this point in the history
Bug when acquiring frame from stream server solved by reshaping the array passed by sockets.
Hardcoded the dimentions and position of the initial object selection box. Now the octave version can use webcam stream.
  • Loading branch information
rasoliveira committed May 24, 2011
1 parent 4c51d86 commit 4ea0d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bbox/bb_click.m
Expand Up @@ -26,12 +26,18 @@
imshow(img);
end
text(10,10,'Define bounding box and double click inside.','color','white');
h = imrect;
p = wait(h);
bb = [p(1); p(2);p(1)+p(3); p(2)+p(4)];
if exist('OCTAVE_VERSION', 'builtin')
% while we don't have a imrect equivalent in Octave
% use the hardcoded bellow (a centered 200x200 pixels box)
bb = [ 640/2-100; 480/2-100; 640/2+100; 480/2+100];
else
h = imrect;
p = wait(h);
bb = [p(1); p(2);p(1)+p(3); p(2)+p(4)];
end
% [c,r,p] = impixel(img);
% if length(c) ~= 2,
% bb = [];
% return;
% end
% bb = [c(1); r(1); c(2); r(2)];
% bb = [c(1); r(1); c(2); r(2)];
1 change: 1 addition & 0 deletions img/img_get.m
Expand Up @@ -24,6 +24,7 @@
else % We don't have the Image Acquisition package, using stream_server
if exist('OCTAVE_VERSION','builtin') % from octave
[ data, count ] = recv (source.socket, 640*480, MSG_WAITALL);
data = reshape (data, [640 480]);
stream_img = transpose(data);
else %from Matlab
stream_img = transpose(fread(source.socket, [640, 480], 'uint8'));
Expand Down

0 comments on commit 4ea0d41

Please sign in to comment.