Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Correction on dimentions of grabbed frame in Octave

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...
commit 4ea0d41f744cde87aa43618e9b282d72593abba0 1 parent 4c51d86
@ludug3r0 ludug3r0 authored
Showing with 11 additions and 4 deletions.
  1. +10 −4 bbox/bb_click.m
  2. +1 −0  img/img_get.m
View
14 bbox/bb_click.m
@@ -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)];
View
1  img/img_get.m
@@ -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'));
Please sign in to comment.
Something went wrong with that request. Please try again.