-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfixes.py
More file actions
50 lines (45 loc) · 1.95 KB
/
fixes.py
File metadata and controls
50 lines (45 loc) · 1.95 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
"""Image fixes"""
#
# Copyright (c) 2023 Vladislav Tsendrovskii
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
import os
import shutil
import vstarstack.library.common
import vstarstack.tool.cfg
import vstarstack.tool.usage
import vstarstack.tool.image_processing.distorsion
import vstarstack.tool.image_processing.remove_sky
import vstarstack.tool.image_processing.border
import vstarstack.tool.image_processing.normalize
import vstarstack.tool.image_processing.blur
def copy(project: vstarstack.tool.cfg.Project, argv: list):
"""Copy files"""
if len(argv) > 2:
orig = argv[0]
fixed = argv[1]
else:
orig = project.config.paths.npy_orig
fixed = project.config.paths.npy_fixed
files = vstarstack.library.common.listfiles(orig, ".zip")
for name, fname in files:
print("Copying ", name)
fname_out = os.path.join(fixed, name + ".zip")
shutil.copyfile(fname, fname_out)
commands = {
"copy": (copy, "just copy images from original to pipeline dir"),
"distorsion": (vstarstack.tool.image_processing.distorsion.run, "fix distorsion"),
"remove-sky": (vstarstack.tool.image_processing.remove_sky.commands, "remove sky"),
"border": (vstarstack.tool.image_processing.border.run, "remove border"),
"normalize": (vstarstack.tool.image_processing.normalize.run, "normalize to weight"),
"blur": (vstarstack.tool.image_processing.blur.run, "gaussian blur"),
}