Skip to content

Commit 588bd09

Browse files
author
Hakan Kurtulus
committed
Typo Correction
1 parent 63885a5 commit 588bd09

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

main.m

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
% Hakan Kurtulus
2-
% HXMKGP
3-
41
clear all; close all; clc; % clear defined variable from previous run
52

63
im = imread('objects.jpg'); %circles are greater than rectangles
74
%im = imread('objects_1.jpg'); %circles and rectangles are equal
85

96
[h, w, ~] = size(im); %get height and width of image
107

11-
distR = double(im(:, :, 1)) - 0; %since we have only one dimention, first dimention of image will be enough
8+
distR = double(im(:, :, 1)) - 0; %since we have only one dimension, first dimension of image will be enough
129

1310
%L2 distance
14-
d2 = (distR .^2); %highlited to background, at the end we will have so big number for background but white parts will be close to 0
11+
d2 = (distR .^2); %highlighted to background, at the end we will have so big number for background but white parts will be close to 0
1512

1613
thres = 13000;
1714
results = d2 <= thres; %we set the boundary for image not to detect image itself but objects
@@ -21,7 +18,7 @@
2118
results = bwmorph(results, 'close', 2);
2219

2320

24-
stats = regionprops(results, 'BoundingBox'); %this gets the stats of each object, we used this with Gabor
21+
stats = regionprops(results, 'BoundingBox'); %this gets the stats of each object
2522

2623
figure, imshow(results);
2724
hold on
@@ -30,19 +27,19 @@
3027
rec_num = 0;
3128
for i = 1 : length(stats)
3229

33-
dimentions = stats(i).BoundingBox;
30+
dimensions = stats(i).BoundingBox;
3431

35-
YourText = sprintf(int2str(i)); %put the iteration numbe rto variable to print as string
32+
YourText = sprintf(int2str(i)); %put the iteration number to variable to print as string
3633

37-
if dimentions(3)== dimentions(4) %3 and 4 stand for height and width of object, if the values are equal it is circle ortherwise ellipse
34+
if dimensions(3)== dimensions(4) %3 and 4 stand for height and width of object, if the values are equal it is circle otherwise ellipse
3835
circle_num = circle_num+1;
39-
hText = text(dimentions(1) + dimentions(3)/2,dimentions(2)+dimentions(4)/2,YourText,'Color',[1 0 1],'FontSize',15); %put the pink string to image
40-
elseif dimentions(3)~= dimentions(4)
36+
hText = text(dimensions(1) + dimensions(3)/2,dimensions(2)+dimensions(4)/2,YourText,'Color',[1 0 1],'FontSize',15); %put the pink string to image
37+
elseif dimensions(3)~= dimensions(4)
4138
rec_num = rec_num+1;
42-
hText = text(dimentions(1) + dimentions(3)/2,dimentions(2)+dimentions(4)/2,YourText,'Color',[0.1 0 0.5],'FontSize',15); %put the blue string to image
39+
hText = text(dimensions(1) + dimensions(3)/2,dimensions(2)+dimensions(4)/2,YourText,'Color',[0.1 0 0.5],'FontSize',15); %put the blue string to image
4340
end
4441

45-
rectangle('Position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 3); %draw a rectangle also we used this with Gabor
42+
rectangle('Position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 3); %draw a rectangle
4643

4744
end
4845

@@ -54,6 +51,6 @@
5451
elseif circle_num < rec_num
5552
final = 'Rectangle numbers are greater than circle numbers.'
5653
elseif circle_num > rec_num
57-
final = 'Circle numbers are greater than rectangler numbers.'
54+
final = 'Circle numbers are greater than rectangle numbers.'
5855
end
5956

0 commit comments

Comments
 (0)