Permalink
Browse files

cropped the image for the output

  • Loading branch information...
1 parent 9a0f8e4 commit 8f32c0c70280e8a5224fd68a5c6c9336edc9bb47 Jennifer Guo committed Jan 11, 2014
Showing with 13 additions and 13 deletions.
  1. +0 −1 code/detect_square/findsquare.m
  2. +13 −12 code/detect_square/runme.m
@@ -22,7 +22,6 @@
end
end
cropped_img = imcrop(bw, maxsquare);
-imshow(cropped_img);
%{
figure('visible', 'off'), imshow(bw, 'Border', 'tight');
hold on;
@@ -17,12 +17,19 @@
filename = filenames(i).name;
% Check if filename is an image
- if (~isempty(strfind(filename, '.jpg')))
+ if (~isempty(strfind(filename, '.jpg')) || ~isempty(strfind(filename, '.png')))
- % Determine filenames
- basename = strrep(filename, '.jpg', '');
- input_filename = strcat('../../input/', basename, '.jpg');
- output_filename = strcat('../../output/square_', basename, '.jpg');
+ if (~isempty(strfind(filename, '.jpg')))
+ % Determine filenames
+ basename = strrep(filename, '.jpg', '');
+ input_filename = strcat('../../input/', basename, '.jpg');
+ output_filename = strcat('../../output/square_', basename, '.jpg');
+ elseif(~isempty(strfind(filename, '.png')))
+ basename = strrep(filename, '.png', '');
+ input_filename = strcat('../../input/', basename, '.png');
+ output_filename = strcat('../../output/square_', basename, '.png');
+ end
+
% Create output image, if it does not already exist
if (force_overwrite || ~exist(output_filename, 'file'))
@@ -40,15 +47,9 @@
% adaptive thresholding to convert to bw image
- bw = adaptivethreshold(input_image, 11, 0.03);
+ bw = adaptivethreshold(input_image, 15, 0.06);
output_image = findsquare(bw);
- % Compute gradients
-% [xgradient_image, ygradient_image] = computegradients ( input_image );
-
- % Combine Canny and Hough into final output
-% output_image = predictlines( canny_image, hough_transform, xgradient_image, ygradient_image, 1.0, 1.0, 2.0 );
-
% End timer
toc

0 comments on commit 8f32c0c

Please sign in to comment.