-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathImage2DSweep.pas
91 lines (74 loc) · 2.38 KB
/
Image2DSweep.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// ###################################################################
// #### This file is part of the artificial intelligence project, and is
// #### offered under the licence agreement described on
// #### http://www.mrsoft.org/
// ####
// #### Copyright:(c) 2014, Michael R. . All rights reserved.
// ####
// #### Unless required by applicable law or agreed to in writing, software
// #### distributed under the License is distributed on an "AS IS" BASIS,
// #### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// #### See the License for the specific language governing permissions and
// #### limitations under the License.
// ###################################################################
unit Image2DSweep;
// ############################################################
// ##### class which can be used to sweep via a sliding window
// ##### over a matrix and classify the parts
// ############################################################
interface
uses BaseClassifier, matrix, contnrs;
type
TClassRec = class(TObject)
fx : integer;
fy : integer;
fwidth : integer;
fheight : integer;
private
function GetBottom: integer;
function GetRight: integer;
public
property x : integer read fx;
property y : integer read fy;
property Width : integer read fWidth;
property Height : integer read fHeight;
property Right : integer read GetRight;
property Bottom : integer read GetBottom;
constructor Create(ax, ay, aWidth, aHeight : integer);
end;
PClassRec = ^TClassRec;
type
TClassRecList = class(TObjectList)
private
function GetItem(index: integer): TClassRec;
public
property Item[index : integer] : TClassRec read GetItem; default;
constructor Create;
end;
implementation
{ TClassRecList }
constructor TClassRecList.Create;
begin
inherited Create(True);
end;
function TClassRecList.GetItem(index: integer): TClassRec;
begin
Result := TClassRec(Items[index]);
end;
{ TClassRec }
constructor TClassRec.Create(ax, ay, aWidth, aHeight: integer);
begin
fX := ax;
fY := aY;
fWidth := aWidth;
fHeight := aHeight;
end;
function TClassRec.GetBottom: integer;
begin
Result := fY + fHeight - 1;
end;
function TClassRec.GetRight: integer;
begin
Result := fX + fWidth - 1;
end;
end.