-
Notifications
You must be signed in to change notification settings - Fork 5
/
NewZonesModelConverter.java
61 lines (47 loc) · 2.05 KB
/
NewZonesModelConverter.java
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
package org.genericsystem.cv.utils;
import org.genericsystem.api.core.Snapshot;
import org.genericsystem.common.Generic;
import org.genericsystem.common.Root;
import org.genericsystem.cv.comparator.FillModelWithData;
import org.genericsystem.cv.model.DocClass;
import org.genericsystem.cv.model.DocClass.DocClassInstance;
import org.genericsystem.cv.model.ModelTools;
import org.genericsystem.cv.model.ZoneGeneric.ZoneInstance;
import org.opencv.core.Rect;
public class NewZonesModelConverter {
private static final String gsPath = System.getenv("HOME") + "/genericsystem/gs-cv_model/";
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
Root root = FillModelWithData.getEngine(gsPath);
DocClass docClass = root.find(DocClass.class);
Snapshot<DocClassInstance> docClasses = (Snapshot) docClass.getInstances();
docClasses.forEach(currentDocClass -> {
System.out.println("--- Current docClass: " + currentDocClass);
Snapshot<ZoneInstance> zoneInstances = currentDocClass.getZones();
zoneInstances.forEach(currentZone -> {
System.out.println("current zone: " + currentZone);
int temp = (int) currentZone.getValue();
Generic zoneNum = currentZone.setZoneNum(temp);
Rect rect = currentZone.getRect();
System.out.println("rect: " + rect);
long start = System.nanoTime();
currentZone.updateValue(ModelTools.generateZoneUID(rect));
long stop = System.nanoTime();
System.out.println("--------- update: " + (stop - start) / 1_000_000 + "ms");
start = System.nanoTime();
root.getCurrentCache().flush();
stop = System.nanoTime();
System.out.println("--- flush: " + (stop - start) / 1_000_000 + "ms");
});
});
docClasses.forEach(currentDocClass -> {
System.out.println("--- Current docClass: " + currentDocClass);
Snapshot<ZoneInstance> zoneInstances = currentDocClass.getZones();
zoneInstances.forEach(currentZone -> {
System.out.println("current zone: " + currentZone);
System.out.println("value: " + currentZone.getValue());
});
});
root.close();
}
}