-
Notifications
You must be signed in to change notification settings - Fork 0
/
rw_file.py
55 lines (43 loc) · 1.14 KB
/
rw_file.py
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
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 17 17:10:17 2019
@author: Binatang Kesusahan
"""
def write(value, file_name):
"""part of callback function when changing the trackbars in object detection configuration script
Parameter
---------
value : int
value to write to the file
file_name : string
file to read, include the extension
"""
value = str(value)
filename = file_name
file = open(str(filename), "w")
file.write(value)
file.close()
def read(file):
"""also part of callback function when changing the trackbars in object detection configuration script
Parameters
---------
file : str
file to read, include the extension"""
f = open(str(file), "r")
return f.read()
def odd(param):
"""file for convert to odd number because all kernel size parameter only able to process with odd number
Parameters
----------
param : int
usually variable with 'kernel' in its name
Returns
-------
int
odd integer number
"""
param = int(param)
if param % 2 == 0:
return param + 1
else:
return param