forked from armanrahman22/mmdxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestMatrixImage.js
More file actions
76 lines (65 loc) · 2.19 KB
/
TestMatrixImage.js
File metadata and controls
76 lines (65 loc) · 2.19 KB
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
/*
Class on which all image analysis operations are performed
Params:
image: the Image object the test strip photo is loaded into
canvas
*/
var TestMatrixImage=function(image, canvasElement){
this.image=image;
this.canvas=canvasElement;
this.markerFrameOuterRect;
this.markerFrameInnerRect;
this.markerLanes=[];
this.diagnosisMap;
}
/*
Params:
colorTracker: tracking.js ColorTracker, therefore tracking.js must be loaded into the page first
Sets the markerFrameOuterRect, if found.
*/
TestMatrixImage.prototype.detectBorderFrame=function(colorTracker){
console.log("Start Detecting outside border");
var tracker = colorTracker;
var markerRectangle;
tracker.on('track', function(event) {
event.data.forEach(function(rect) {
console.log("tracking found rect: ");
console.log(rect);
var x = rect.x;
var y = rect.y;
var w = rect.width;
var h = rect.height;
//corners might change
var corners = [new Point(x,y),new Point(x+w, y+h), new Point(x+w,y), new Point(x, y+h)];
markerRectangle=new Rectangle(corners);
});
});
tracking.track(this.canvas, tracker); //start tracking
this.markerFrameOuterRect=markerRectangle;
}
TestMatrixImage.prototype.detectInnerFrame=function(colorTracker){
console.log("Start Detecting inner");
var tracker = colorTracker;
var markerRectangle;
tracker.on('track', function(event) {
event.data.forEach(function(rect) {
console.log("tracking found rect: ");
console.log(rect);
var x = rect.x;
var y = rect.y;
var w = rect.width;
var h = rect.height;
//corners might change
var corners = [new Point(x,y),new Point(x+w, y+h), new Point(x+w,y), new Point(x, y+h)];
markerRectangle=new Rectangle(corners);
});
});
tracking.track(this.canvas, tracker); //start tracking
this.markerFrameInnerRect=markerRectangle;
}
TestMatrixImage.prototype.detectMarkerLaneLocations=function(){
}
TestMatrixImage.prototype.processLanes=function(){
}
TestMatrixImage.prototype.diagnose=function(){
}