Skip to content

Commit bdddf37

Browse files
committed
Submission
2 parents f02be67 + ec7e3e2 commit bdddf37

26 files changed

+359
-67
lines changed

Diff for: Backend/create_output.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
class MyFPDF(FPDF, HTMLMixin):
1313
pass
1414

15-
def table_html(points, legends):
15+
def table_html(points, legends, heading):
16+
headi = heading[0]
1617
ni = len(points[0]) - 1
1718
print ni
1819
width_perc = str(100/(int(ni)+1)) + '%'
1920
print width_perc
2021
op_tags = '<tr><td>'
2122
md_tags = '</td><td>'
2223
cl_tags = '</td></tr>'
23-
yield '<H1 align="center">html2fpdf</H1>'
24+
yield '<H1 align="center">%s</H1>' % (headi)
2425
yield '<table border="1" align="center" width="100%">'
2526
yield '<thead><tr>'
2627
yield '<th width="%s">%s</th>' % (width_perc,'X')
@@ -36,14 +37,14 @@ def table_html(points, legends):
3637
yield '</tbody>'
3738
yield '</table>'
3839

39-
def call_write(file, legends):
40+
def call_write(file, legends, heading):
4041
delimiter = 0
4142
points = []
4243
ni = 0
4344
with open(file) as infile:
4445
for line in infile:
4546
points.append(line.split())
46-
return ''.join(list(table_html(points, legends)))
47+
return ''.join(list(table_html(points, legends, heading)))
4748

4849
def main():
4950
html = ''
@@ -54,11 +55,13 @@ def main():
5455
eachLegendLine = line.split(" ")
5556
secondWord = eachLegendLine[1]
5657
legends.append(secondWord)
57-
58+
with open("heading.txt") as head:
59+
heading = head.readlines()
60+
print heading
5861
legends = [l.strip("\n") for l in legends]
5962
print legends
6063
for file in glob.glob("*_plot.txt"):
61-
html = html + call_write(file, legends)
64+
html = html + call_write(file, legends, heading)
6265
with open(str(os.getcwd().split("graph_extractor",1)[1].replace("/","_")) + '_html.txt', 'a') as infile:
6366
infile.write(html);
6467
print html

Diff for: Backend/graph_extractor/opensoft1

8 Bytes
Binary file not shown.

Diff for: Backend/graph_extractor/opensoftGraphP1.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ void onTrackbar()
682682
rby1 = rectanglesForAxes[i].rb.second - lty;
683683

684684
char buf[1024];
685-
strcpy(buf, "boundary");
685+
strcpy(buf, name.c_str());
686686
strcat(buf,".txt");
687687
FILE *ftr=fopen(buf,"w");
688688
// printf("path->%s\n",buf);

Diff for: Backend/graph_extractor/temp3.txt

+25-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,25 @@
1-
test_004.tar.gz
1+
graph_0
2+
graph_0.jpg
3+
graph_0.png
4+
graph_0_ticksX.txt
5+
graph_0.txt
6+
graph_1
7+
graph_1.jpg
8+
graph_1.png
9+
graph_1_ticksX.txt
10+
graph_1.txt
11+
graph_2
12+
graph_2.jpg
13+
graph_2.png
14+
graph_2_ticksX.txt
15+
graph_2.txt
16+
graph_3
17+
graph_3.jpg
18+
graph_3.png
19+
graph_3_ticksX.txt
20+
graph_3.txt
21+
graph_4
22+
graph_4.jpg
23+
graph_4.png
24+
graph_4_ticksX.txt
25+
graph_4.txt

Diff for: Backend/graph_extractor/test_004.tar.gz

-869 KB
Binary file not shown.

Diff for: Backend/htmlpdfgen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def call_write(file):
1111
return content
1212

1313
def main():
14-
html = ''
14+
html = '<H1 align="center">TEAM 04</H1>'
1515
for file in glob.glob("./graph*/test*/graph*/*_html.txt"):
1616
html = html + ''.join(call_write(file))
1717
print html

Diff for: Backend/legend_detection

3.27 MB
Binary file not shown.

Diff for: Backend/match_legend

4.11 MB
Binary file not shown.

Diff for: Backend/scaledetection/recognize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int main(int argc, char **argv)
134134
NULL, 0, &vars_vec, &vars_values, false);
135135

136136
/* restrict to numbers*/
137-
api->SetVariable("tessedit_char_whitelist","0123456789.");
137+
api->SetVariable("tessedit_char_whitelist","0123456789");
138138
api->SetVariable("language_model_penalty_non_dict_word", "0");
139139
api->SetImage(pixs);
140140
api2->SetVariable("language_model_penalty_non_dict_word", "0");

Diff for: Backend/separate_colors

5.15 MB
Binary file not shown.

Diff for: Backend/test.txt~

Whitespace-only changes.

Diff for: Backend/testx

109 KB
Binary file not shown.

Diff for: Backend/testx.cpp

+111-23
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,8 @@ using namespace std;
2828
#define R(x) (((x)<<1)+2)
2929
#define umap unordered_map
3030
//#define double long double
31-
#define mod 1000000007
32-
#define mod1 1000000009
33-
#define LIMIT 10000000000000000LL
34-
#define MAX1 1000000000
35-
//#define si(n) scanf("%d",&n)
36-
//#define sii(n,m) scanf("%d%d",&n,&m)
37-
//#define pi(n) printf("%d\n",n)
38-
const int inf=0x3f3f3f3f;
39-
const long double pi=acos(-1.0);
40-
#define INF 1000000000000000000LL
41-
#define MAX 1000005
42-
#define N 410
4331
const string debug_line="yolo";
4432
#define debug error(debug_line)
45-
const double PI=4*atan(1);
46-
#define read() freopen("mergedoutput.txt","r",stdin)
47-
#define write() freopen("output.txt","w",stdout)
48-
//template <typename T> using os = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
4933
typedef long long ll;
5034
typedef pair<int,int>pii;
5135
typedef vector<int> vi;
@@ -62,19 +46,19 @@ int count1[1001];
6246
map<int,int> mp1;
6347

6448
int main(){
65-
FILE *ftr=fopen("axisvalxs.txt","r");
49+
FILE *ftr=fopen("axisvalsx.txt","r");
6650
char c[1001];
6751
fscanf(ftr,"%s",c);
6852
int temp;
6953
int i=0;
7054
pii t1;
7155
while(fscanf(ftr,"%d",&temp)!=EOF){
7256
if(i==0){
73-
t1.x=temp;
57+
t1.y=temp;
7458
i=1-i;
7559
}
7660
else{
77-
t1.y=temp;
61+
t1.x=temp;
7862
values.pb(t1);
7963
i=1-i;
8064
}
@@ -85,12 +69,116 @@ int main(){
8569
}
8670

8771
sort(all(values));
88-
int min1=values[0].x;
89-
int max11=values[values.size()-1].x;
90-
int max12;
72+
73+
For(i,0,values.size()-1){
74+
int temp=abs(values[i].y-values[i+1].y);
75+
mp1[temp]++;
76+
}
77+
78+
int max1=-1;
79+
int pos1=-1;
80+
int sum1=0;
81+
int count=0;
82+
83+
rep(t1,mp1){
84+
if(t1.y>max1){
85+
max1=t1.y;
86+
pos1=t1.x;
87+
}
88+
}
89+
90+
vi answer1;
91+
max1=-1;
92+
debug;
93+
94+
vector<pair<double,double> > function;
95+
vector<double> lol;
96+
set<pair<int,int> > s1;
97+
int width1=0;
98+
int widthcount=0;
99+
100+
For(j,0,values.size()-1){
101+
if(abs(values[j].y-values[j+1].y)==pos1){
102+
width1+=abs(values[j].x-values[j+1].x);
103+
widthcount++;
104+
if(s1.find(values[j])==s1.end()){
105+
s1.insert(values[j]);
106+
function.pb(mp(values[j].x,values[j].y));
107+
}
108+
if(s1.find(values[j+1])==s1.end()){
109+
s1.insert(values[j+1]);
110+
function.pb(mp(values[j+1].x,values[j+1].y));
111+
}
112+
}
113+
}
114+
double pivot=(double)width1/(double)widthcount;
115+
double temp2=0;
116+
int k=i;
117+
double min1=0;
118+
double max11=0;
119+
double max12=0;
120+
for(int i=0;i<function.size();i++){
121+
temp2=1;
122+
k=i;
123+
for(int j=0;j<function.size();j++){
124+
if(k==j){
125+
continue;
126+
}
127+
else{
128+
temp2=temp2*(values[0].x-function[j].x)/(function[k].x-function[j].x);
129+
}
130+
}
131+
lol.pb(temp2*function[i].y);
132+
}
133+
134+
rep(t1,lol){
135+
min1=min1+t1;
136+
}
137+
lol.clear();
138+
139+
for(int i=0;i<function.size();i++){
140+
temp2=1;
141+
k=i;
142+
for(int j=0;j<function.size();j++){
143+
if(k==j){
144+
continue;
145+
}
146+
else{
147+
temp2=temp2*(values[values.size()-1].x-function[j].x)/(function[k].x-function[j].x);
148+
}
149+
}
150+
lol.pb(temp2*function[i].y);
151+
}
152+
rep(t1,lol){
153+
max11+=t1;
154+
}
155+
lol.clear();
156+
157+
for(int i=0;i<function.size();i++){
158+
temp2=1;
159+
k=i;
160+
for(int j=0;j<function.size();j++){
161+
if(k==j){
162+
continue;
163+
}
164+
else{
165+
temp2=temp2*(values[values.size()-1].x+pivot-function[j].x)/(function[k].x-function[j].x);
166+
}
167+
}
168+
lol.pb(temp2*function[i].y);
169+
}
170+
rep(t1,lol){
171+
max12+=t1;
172+
}
173+
174+
rep(t1,function){
175+
cout<<t1.x<<" "<<t1.y<<"\n";
176+
}
177+
178+
cout<<values[values.size()-1].x+pivot<<" "<<values[values.size()-1].x<<" "<<pos1<<"\n";
91179
cout<<min1<<" "<<max11<<" "<<max12<<"\n";
92180

93-
FILE* p = fopen("axisvalxs.txt","w");
181+
FILE* p = fopen("axisvalsx.txt","w");
94182
fprintf(p, "%.2lf\n%.2lf\n%.2lf",min1,max11,max12);
95183
fclose(p);
96184

Diff for: Backend/testy

109 KB
Binary file not shown.

0 commit comments

Comments
 (0)