Permalink
Browse files

deleted detectline folder in extract_digits

  • Loading branch information...
1 parent 662f897 commit 835baa4379e069647fc47402bea6b2fb4e5b86f1 Jennifer Guo committed Jan 14, 2014
@@ -1,45 +0,0 @@
-function [ xgradient_image, ygradient_image ] = computegradients( input_image )
-
- % Get the input image dimensions
- [height, width] = size(input_image);
-
- %{
- % Initialize gradient images to be all zeroes
- xgradient_image = zeros(height, width);
- ygradient_image = zeros(height, width);
- %}
-
-
- g_filter = fspecial('gaussian', 10, 1);
- d_filter_x = [-1,1];
- d_filter_y = [1 ; -1];
-
- %{
- xgradient_image = imfilter(gray_image, g_filter, 'conv');
- ygradient_image = imfilter(gray_image, g_filter, 'conv');
-
- xgradient_image = imfilter(xgradient_image, d_filter_x, 'conv');
- ygradient_image = imfilter(ygradient_image, d_filter_y, 'conv');
- %}
-
-
-
- filter_x = conv2(g_filter, d_filter_x, 'same');
- filter_y = conv2(g_filter, d_filter_y, 'same');
-
- xgradient_image = conv2(input_image, filter_x, 'same');
- ygradient_image = conv2(input_image, filter_y, 'same');
-
- %{
- xgradient_image = conv2(input_image, g_filter, 'same');
- ygradient_image = conv2(input_image, g_filter, 'same');
-
- xgradient_image = conv2((xgradient_image), d_filter_x, 'same');
- ygradient_image = conv2((ygradient_image), d_filter_y, 'same');
- %}
-
- %xgradient_image = ((xgradient_image + 255) / 510 * 255);
- %ygradient_image = ((ygradient_image + 255) / 510 * 255);
- % COMPUTE IMAGE GRADIENTS HERE
-
-end
@@ -1,70 +0,0 @@
-function canny_image = detectedges( xgradient_image, ygradient_image )
-
- % Get the input image dimensions
- [height, width, ~] = size(xgradient_image);
-
-
- % Initialize output image to be all zeroes
- canny_image = zeros(height, width);
-
-
- magnitude = sqrt(xgradient_image .* xgradient_image + ygradient_image .* ygradient_image);
- direction = atan(ygradient_image ./ xgradient_image);
-
-
- supress_result = magnitude;
-
- for H = 2:1:height-1
- for W = 2:1:width-1
- if(direction(H,W)>=-(pi/8) && direction(H,W)<(pi/8))
- if(magnitude(H,W)<magnitude(H,W+1) || magnitude(H,W)<magnitude(H,W-1))
- supress_result(H,W) = 0;
- end
- elseif(direction(H,W)>=(pi/8) && direction(H,W)<(3*pi/8))
- if(magnitude(H,W)<magnitude(H-1,W+1) || magnitude(H,W)<magnitude(H+1,W-1))
- supress_result(H,W) = 0;
- end
- elseif(direction(H,W)>=-(3*pi/8)&& direction(H,W)<-(pi/8))
- if(magnitude(H,W)<magnitude(H-1,W-1) || magnitude(H,W)<magnitude(H+1,W+1))
- supress_result(H,W) = 0;
- end
- else
- if(magnitude(H,W)<magnitude(H-1,W) || magnitude(H,W)<magnitude(H+1,W))
- supress_result(H,W) = 0;
- end
-
- end
-
- end
- end
-
- for h=1:height-1:height
- for w=1:width-1:width
- supress_result(h,w) = 0;
- end
- end
-
-
- %{
- tHi = 0.08;
- tLo = 0.01;
- highmask = supress_result>tHi;
- lowmask = bwlabel(~(supress_result<tLo));
- final = ismember(lowmask,unique(lowmask(highmask)));
- canny_image = final .* magnitude;
- %}
-
-
- %imshow(uint8(magnitude));
- T_h = 0.08;
- T_l = 0.01;
- strong = (supress_result) > T_h;
- [weakr, weakc] = find((supress_result)>T_l);
- bw = bwselect(strong, weakc, weakr, 8);
- %canny_image = supress_result;
- %imshow(uint8(supress_result))
- canny_image = bw .* magnitude;
-
- % IMPLEMENT THE CANNY EDGE DETECTION ALGORITHM HERE
-
-end
@@ -1,107 +0,0 @@
-function output_image = predictlines( canny_image, hough_transform, xgradient_image, ygradient_image, alpha, beta, gamma )
-
- % Get the input image dimensions
- [height, width, ~] = size(canny_image);
-
- % Initialize output image to be all zeroes
- output_image = zeros(height, width);
-
- [hough_height, hough_width] = size(hough_transform);
-
- theta = atan(ygradient_image ./ xgradient_image);
-
-
- for h=1:1:height
- y = -(h-height/2);
- for w=1:1:width
- x = w-width/2;
- if(canny_image(h,w)~=0)
- maximum = 0;
- for a=1:1:180
- d = -x*cos(degtorad(a)) - y*sin(degtorad(a));
- angle = a;
- if(d<=0)
- d = abs(d);
- angle = mod(angle+180,360);
- end
- ix1 = floor(d);
- ix2 = ceil(d);
- iy = angle;
- dx = d-ix1;
- weight1 = (1.0-dx);
- weight2 = dx;
-
- if(ix1==0)
- ix1 = hough_height;
- end
- if(ix2==0)
- ix2 = hough_height;
- end
- if(iy==0)
- iy = hough_width;
- end
-
- image = (canny_image(h,w)^alpha * (hough_transform(ix1,iy)*weight1+hough_transform(ix2,iy)*weight2)^beta * cos(theta(h,w)-degtorad(angle))^gamma);
- if(image>maximum)
- maximum = image;
- end
- end
- output_image(h,w) = maximum;
- end
- end
- end
-
-
-
- for h=1:height-1:height
- for w = 1:width-1:width
- output_image(h,w) = 0;
- end
- end
- output_image = output_image + 0.001;
- output_image = output_image / max(max(output_image)) +1 ;
- output_image = log(output_image);
- output_image = output_image+exp(1);
- output_image = output_image/exp(1);
- output_image = output_image / max(max(output_image));
- output_image(output_image <= 0.7985) = 0;
- output_image = output_image * 0.8;
-
-
-
- %{
- positive_list = output_image(output_image > 0);
- minimum = prctile(positive_list, 0) * 0.2;
- maximum = prctile(positive_list, 95) * 1.25;
- prctile(positive_list, 100);
- output_image( output_image > 0 & output_image < maximum ) = ...
- (output_image(output_image > 0 & output_image < maximum) - minimum) ./ (maximum - minimum);
- output_image( output_image >= maximum ) = 1;
- %}
-
- %{
-
- disp(max(max(output_image)));
- disp(min(min(output_image)));
-
- %}
-
- %{
-
- max_value = max(max(output_image));
- output_image = output_image / max_value;
-
- positive_list = output_image(output_image > 0);
-
- minimum = prctile(positive_list, 0) * 15;
- maximum = prctile(positive_list, 95) * 0.5;
- prctile(positive_list, 100);
- output_image( output_image > 0 & output_image < maximum ) = ...
- (output_image(output_image > 0 & output_image < maximum) - minimum) ./ (maximum - minimum);
- output_image( output_image >= maximum ) = 1;
- %}
- %disp(output_image)
-
- % COMBINE THE CANNY EDGES AND HOUGH TRANFORM INTO THE FINAL LINE PREDICTION HERE
-
-end
Oops, something went wrong.

0 comments on commit 835baa4

Please sign in to comment.