def loadFromFile(self, file): if file[-3:] != 'ini': self.root.notification('Load', 'wrong file extension') return commands = ConfigParser() commands.read(file) try: for section in commands.sections(): for values in commands.items(section): self.commands.set(section, values[0], values[1]) if section in self.updateSettings.keys(): self.updateSettings[section].update({values[0]:values[1]}) else: self.updateSettings.update({section:{values[0]:values[1]}}) self.root.notification('Load', 'load successful') App.get_running_app().root.ids.settingsLayout.ids.option.setOptions() except: self.root.notification('Load', 'wrong file')
class Drawing(Screen): events_callback = ObjectProperty(None) sets = ObjectProperty(None) title_previous = StringProperty('') # 액션바 selectedImagePath = StringProperty('') def __init__(self, **kwargs): super(Drawing, self).__init__(**kwargs) # self.pos = (0,0) # self.size_hint = (1,1) self.config = ConfigParser() # pencil case 에 들어가는 색상번호, 색상명, rgb정보 읽어오기 def _get_colors(self): self.config.read(os.path.join(directory, 'Libs/mangopaint.ini')) _items = self.config.items('PencilCase') for key, _item in _items: img_sh = _item.split(',') _data = { 'key': key, 'image': img_sh[0], 'pgm': img_sh[1], 'order': img_sh[2] } self.color_data.list.append(_data) # drawing.kv 에서 호출하는 drawing 화면 생성하기 def create_drawing_screen(self, imagePath): self.color_data = Box() self.color_data.pos = 0 self.color_data.list = [] self._get_colors() # self.color_data.list.sort(key=lambda x: int(x['order'])) self.pencilcase = PencilCase(meta=self.color_data) self.pencilcase.update() self.selectedImagePath = imagePath self.add_widget(self.pencilcase) self.ids.origin_image.source = 'Data/MyStudio/mystudio_origin.png' self.ids.myimage.source = 'Data/MyStudio/mystudio_draw_save.png' self.ids.origin_image.reload() self.ids.myimage.reload() _button_layout = BoxLayout( orientation='horizontal', size_hint=(1, None), height=50, ) save_button = Button(text='saving_image') save_button.bind(on_press=self.save_drawing) _button_layout.add_widget(save_button) complete_buotton = Button(text='complete_image') complete_buotton.bind(on_press=self.compelete_drawing) _button_layout.add_widget(complete_buotton) self.ids.button_layout.add_widget(_button_layout) # 두 개의 scatter layout들이 같이 연동해서 확대/축소 할수 있는 기능으로 구현하고자 함. self.ids.myimage.bind(on_touch_down=self.sync_sctters) def sync_sctters(self, touch): self.ids.origin_image = touch def drawing(self): pass def save_drawing(self, touch): print('save drawing') def compelete_drawing(self, touch): print('complete drawing') # pencilcase 클래스 랜더링 # def update_pencilcase(self): # self.pencilcase.update() # drawing 화면에서 다시 갤러리 화면으로 돌아갈때. def remove_drawing_widgets(self): print('destroyed drawing') self.color_data.clear() self.ids.button_layout.clear_widgets() def callback(self, obj): print(obj.source) # self.selectedImagePath = obj.source # _save_file = (Image.open(self.selectedImagePath)).crop() # _save_file.save('Data/temp.png') self.parent.current = 'gallery'
class Effects(Screen): events_callback = ObjectProperty(None) sets = ObjectProperty(None) title_previous = StringProperty('') # 액션바 selectedImagePath = StringProperty('') def __init__(self, **kwargs): super(Effects, self).__init__(**kwargs) # self.pos = (0,0) # self.size_hint = (1,1) self.config = ConfigParser() # effect 효과의 타이틀명, 샘플이지미파일, 효과 프로그램명 정보 읽어오기 def _get_effects(self): self.config.read(os.path.join(directory, 'Libs/mangopaint.ini')) _items = self.config.items('Effects') for key, _item in _items: img_sh = _item.split(',') _data = { 'key': key, 'image': img_sh[0], 'pgm': img_sh[1], 'order': img_sh[2] } self.effects_data.list.append(_data) # effects.kv 에서 호출하는 effects 화면 생성하기 def create_effects_screen(self, imagePath): self.effects_data = Box() self.effects_data.pos = 0 self.effects_data.list = [] self._get_effects() self.effects_data.list.sort(key=lambda x: int(x['order'])) self.effectsbar = EffectsBar(meta=self.effects_data) self.effectsbar.update() self.selectedImagePath = imagePath self.ids.myimage.source = self.selectedImagePath self.add_widget(self.effectsbar) # self.ids.spinner.determinate = True # self.ids.spinner.determinate_time = 3 button_layout = BoxLayout( orientation='horizontal', size_hint=(1, None), height=50, ) seg_button = Button(text='segment_image') seg_button.bind(on_press=self.segment_image) button_layout.add_widget(seg_button) draw_buotton = Button(text='draw_image') draw_buotton.bind(on_press=self.draw_image) button_layout.add_widget(draw_buotton) self.add_widget(button_layout) # effectsbar 화면 랜더링 # def update_effectsbar(self): # self.effectsbar.update() # ########################################### # effect 효과를 적용하도록 화면 변경하가 # ########################################### def convert_with_effect(self, image_pos): print('=======>>> convert_with_effect') self.effects_data.pos = image_pos _data = self.effects_data.list[image_pos] cmd = [] # if 조건이 exclusive 하지 않아 혹 조건을 빠져나갈수 있는 위험이 있으니 주의할것! # 우선 뉴럴스타일이면, 다음으로 특정스타일을 물어보는 식이라... if _data.pgm == 'neural_style.py': args, output = self.neural_style_arguments(image_pos, _data.key) elif _data.key == 'edge_detect': args, output = self.edge_detect_arguments(image_pos) elif _data.key == 'water_color': args, output = self.water_color_arguments(image_pos) elif _data.key == 'oil_color': args, output = self.oil_color_arguments(image_pos) else: args, output = self.edge_detect_arguments(image_pos) ################################################################# if _data.pgm in ['edge_detecting.py', 'neural_style.py']: cmd.append(sys.executable or 'python3') cmd.append(args) print(cmd[0] + cmd[1]) process = Popen(cmd[0] + cmd[1], shell=True, stdout=PIPE, stderr=STDOUT) out, err = process.communicate() print("@@@@@@@ out: ", out) print("@@@@@@@@@ err", str(err)) ################################################################# print('python3', args) self.ids.myimage.source = output print('effect function end: ' + _data.key + ' <==================') self.ids.myimage.reload() # 뉴럴스타일 방식의 패턴은 아래 함수로 집중 def neural_style_arguments(self, image_pos, key): # python3 ./fast_neural_style/neural_style.py eval --content-image ../../../images/Colorful-Paint-with-Paper-Texture.jpg --model ./fast_neural_style/saved_models/mosaic.model --output-image ../Data/temp.png --cuda 0 _pgm = os.path.join(directory, 'Effects/fast_neural_style', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') _cuda = 0 _model = os.path.join(directory, 'Effects/fast_neural_style/saved_models', key + '.model') args = " {} eval --content-image {} --model {} --output-image {} --cuda {}".format( _pgm, self.selectedImagePath, _model, output, _cuda) # neuralStyle( # subcommand="eval", # content_image=self.selectedImagePath, # content_scale=None, # model=_model, # output_image=output, # cuda=_cuda, # export_onnx=None # ).run() return args, output # 흑백 스케치 느낌 (아직은 칼라네요....) def edge_detect_arguments(self, image_pos): # python3 edge_detecting.py --content=$1 --output=$2 --blurred=$3 # python3 edge_detecting.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_edge_result.png" --blurred 3 _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {} --blurred {}".format( _pgm, self.selectedImagePath, output, 3) # EdgeDetecting( # content=self.selectedImagePath, # output=os.path.join(directory, 'Data', 'temp.png'), # blurred=3 # ).run() return args, output # 수채화 느낌 def water_color_arguments(self, image_pos): # python3 Water_coloring.py --content=$1 --output=$2 # python3 water_coloring.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_water_result.png" _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {}".format(_pgm, self.selectedImagePath, output) WaterColoring(content=self.selectedImagePath, output=output).run() return args, output # 유화 느낌 def oil_color_arguments(self, image_pos): # python oil_painting.py --content=$1 --output=$2 --radius=$3 --intensity=$4 # python3 oil_coloring.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_oil_result.png" --radius 5 --intensity 20 _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {} --radius {} --intensity {}".format( _pgm, self.selectedImagePath, output, 5, 20) OilColoring(content=self.selectedImagePath, output=output, radius=5, intensity=20).run() return args, output # effects 화면에서 다시 갤러리 화면으로 돌아갈때. def remove_effects_widgets(self): self.effects_data.clear() try: self.remove_widget(self.md_app_bar) except AttributeError: pass print('destroyed effects') # def gen_image(self): # return os.path.join(directory, 'Effects', # self.meta.list[image_pos].image) # effects 효과를 선정한 후, 1) 조각내기 (segment) 공정을 실행함. def segment_image(self, instance): # python segment_image.py --content=$1 --output=$2 --KERNEL_SIZE=$3 --COLOR_TYPE=$4 --THREASH=$5 --BLURRED=$6 --cuda=$7 # python3 segment_image.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_oil_result.png" --radius 5 --intensity 20 print('=======>>> segment') cmd = [] cmd.append(sys.executable) _pgm = os.path.join(directory, 'Programs', 'segment_image.py') _content = os.path.join(directory, 'Data', 'temp.png') _output = os.path.join(directory, 'Data', 'temp_col_seg.png') # kernel_size value controls the size of segments ( >= 1. ) # ex) 1.0(Standard): 1,000ea. ==> 1.5: 600ea. ==> 2.1: 370ea. ==> 3.0: 288ea. ==> 4.0: 255ea. _KERNEL_SIZE = 1.0 # color type: 1: 256 colors ==> 2: 128 colors ==> 3: 64 colors ==> # 4: 36 colors ==> 5: 24 colors ==> 6: 12 colors _COLOR_TYPE = 1 # thresh : segments size control >>> 30: small ==> 20: medium ==> 10:large _THRESH = 10 # blurred staus >>> normal:7 _BLURRED = 7 # 0: CPU, 1: GPU _cuda = 0 _args = " {} --content {} --output {} --KERNEL_SIZE {} --COLOR_TYPE {} --THRESH {} --BLURRED {} --cuda {}".format( _pgm, _content, _output, _KERNEL_SIZE, _COLOR_TYPE, _THRESH, _BLURRED, _cuda) cmd.append(_args) print(cmd[0] + cmd[1]) # SegmentImage( # content=_content, # output=_output, # KERNEL_SIZE=_KERNEL_SIZE, # COLOR_TYPE=_COLOR_TYPE, # THRESH=_THRESH, # BLURRED=_BLURRED, # cuda=_cuda # ).run() process = Popen(cmd[0] + cmd[1], shell=True, stdout=PIPE, stderr=STDOUT) out, err = process.communicate() # if err is not None ==> print() 로 추가할 부분 print("@@@@@@@@ segment return code: " + str(err) + " :: " + str(out)) self.ids.myimage.source = _output self.ids.myimage.reload() print('segment function end: <<<=======') Clock.schedule_once(self.change_to_gray_seg) # 컬로의 조각내기를 5초후에 자동으로 흑백모드의 조각내기로 바꾸는 함수 def change_to_gray_seg(self, instance): print('=======>>> gray segment') _output = os.path.join(directory, 'Data', 'temp_segment.png') time.sleep(5) self.ids.myimage.source = _output self.ids.myimage.reload() print('gray segment function end: <<<=======') self.md_app_bar = MDBottomAppBar( # md_bg_color=self.theme_cls.primary_color, # left_action_items=[ # ['menu', lambda x: x], # ['clock', lambda x: x], # ['dots-vertical', lambda x: x]], anchor='right', callback=self.callback_segment) self.add_widget(self.md_app_bar) # effects 효과를 선정한 후, 2) 초안그리기 (draw) 의 공정을 실행함. def draw_image(self, instance): # python draw_image.py --content=$1 --output=$2 print('=======>>> draw') cmd = [] cmd.append(sys.executable or 'python3') _pgm = os.path.join(directory, 'Programs', 'draw_image.py') _content = os.path.join(directory, 'Data', 'temp.png') _output = os.path.join(directory, 'Data', 'temp_draw.png') _sigma = 1 # # blurred staus >>> normal:7 # _BLURRED = 1 # _args = " {} --content {} --output {} --BLURRED {}".format(_pgm, _content, _output, _BLURRED) _args = " {} --content {} --output {} --sigma {}".format( _pgm, _content, _output, _sigma) cmd.append(_args) print(cmd[0] + cmd[1]) DrawImage(content=_content, output=_output, sigma=_sigma).run() # process = Popen(cmd[0] + cmd[1], shell=True, stdout=PIPE, stderr=STDOUT) # out, err = process.communicate() self.ids.myimage.source = _output self.ids.myimage.reload() print('draw function end: <<<=======') self.md_app_bar = MDBottomAppBar( # md_bg_color=self.theme_cls.primary_color, # left_action_items=[ # ['menu', lambda x: x], # ['clock', lambda x: x], # ['dots-vertical', lambda x: x]], anchor='right', callback=self.callback_draw) self.add_widget(self.md_app_bar) def callback_segment(self, obj): _save_file = (pil_image.open('Data/temp_col_seg.png')).crop() _save_file.save('Data/MyStudio/mystudio_seg_origin.png') _save_file = (pil_image.open('Data/temp_segment.png')).crop() _save_file.save('Data/MyStudio/mystudio_seg_save.png') self.parent.current = 'painting' def callback_draw(self, obj): _save_file = (pil_image.open('Data/temp.png')).crop() _save_file.save('Data/MyStudio/mystudio_origin.png') _save_file = (pil_image.open('Data/temp_draw.png')).crop() _save_file.save('Data/MyStudio/mystudio_draw_save.png') self.parent.current = 'drawing'
def update_program(self): """Проверяет наличие обновлений на сервере github,com. Проверяестя версия программы, версии плагинов, наличие измененных программых файлов.""" if platform != "android": print("Проверка обновлений:") print("------------------------------------") temp_path = "{}/Data/temp".format(core.prog_path) if not os.path.exists(temp_path): os.mkdir(temp_path) update_file = urllib.urlopen( "https://github.com/HeaTTheatR/HeaTDV4A/raw/master/" "Data/uploadinfo.ini").read() open("{}/uploadinfo.ini".format(temp_path), "w").write( update_file) config_update = ConfigParser() config_update.read("{}/uploadinfo.ini".format(temp_path)) info_list_update = [] new_version_program = \ config_update.getfloat("info_update", "new_version_program") updated_files_program = \ eval(config_update.get("info_update", "updated_files_program")) dict_official_plugins_program = \ config_update.items("plugin_update") official_plugins_program = dict(dict_official_plugins_program) install_user_plugins = self.started_plugins current_version_program = __version__ if platform != "android": print("Проверка версии программы ...") print("Проверка актуальности плагинов ...") for plugin in install_user_plugins.keys(): try: info_official_plugin = eval(official_plugins_program[plugin]) if info_official_plugin[plugin]['plugin-version'] > \ install_user_plugins[plugin]['plugin-version']: info_list_update.append(info_official_plugin) if platform != "android": print("Плагин '{}' обновился до версии '{}'!".format( plugin, info_official_plugin[plugin][ 'plugin-version'])) except KeyError: continue if platform != "android": print("Проверка обновлений завершена ...") print("------------------------------------") print() if len(info_list_update) or new_version_program > \ current_version_program: self.update = True if platform != "android": print("Доступны обновления!") print("------------------------------------") print() else: if platform != "android": print("Обновлений нет!") print("------------------------------------") print()
<Target>: canvas: Color: rgba: 0.7, 0, 0, 1 Rectangle: pos: self.pos size: self.size ''') # Load in the configuration options set from the main app # TODO: Figure out how to load settings upon use, not load # Consider moving it and its dependents into the run function tw_config = ConfigParser() tw_config.read('main.ini') caesar_config = dict(tw_config.items('trainingwheels')) print(caesar_config) # Success audio setup if path.exists(caesar_config['success_audio_path']): print(caesar_config['success_audio_path']) success_sound = SoundLoader.load(caesar_config['success_audio_path']) if success_sound: print('woohoo, success sound') else: print('doh, no sound') # Failure audio setup if path.exists(caesar_config['failure_audio_path']): print(caesar_config['failure_audio_path']) failure_sound = SoundLoader.load(caesar_config['failure_audio_path'])
class Painting(Screen): events_callback = ObjectProperty(None) # 돌아갈 callback 함수 ????? sets = ObjectProperty(None) title_previous = StringProperty('') # 액션바 selectedImagePath = StringProperty('') color_data = ListProperty() def __init__(self, **kwargs): super(Painting, self).__init__(**kwargs) self.config = ConfigParser() # palette 에 들어가는 색상번호, 색상명, rgb정보 읽어오기 def _get_colors(self): self.config.read(os.path.join(directory, 'Libs/mangopaint.ini')) _items = self.config.items('Palette') for key, _item in _items: img_sh = _item.split(',') _data = { 'key': key, 'image': img_sh[0], 'pgm': img_sh[1], 'order': img_sh[2] } self.color_data.list.append(_data) # painting.kv 에서 호출하는 painting 화면 생성하기 def create_painting_screen(self, imagePath): self.color_data = Box() self.color_data.pos = 0 self.color_data.list = [] self._get_colors() # self.color_data.list.sort(key=lambda x: int(x['order'])) self.palette = Palette(meta=self.color_data, size_hint=(1, .1)) self.palette.update() self.selectedImagePath = imagePath self.add_widget(self.palette) _button_layout = BoxLayout( orientation='horizontal', size_hint=(1, None), height=50, ) self.save_button = Button(text='saving_image') self.save_button.bind(on_press=self.save_painting) _button_layout.add_widget(self.save_button) self.complete_button = Button(text='complete_image') self.complete_button.bind(on_press=self.compelete_painting) _button_layout.add_widget(self.complete_button) self.ids.button_layout.add_widget(_button_layout) # segment 된 원본(origin) 이미지 표현하기. self.myorigin = MyOrigin(pos=(0, 0), do_rotation=False, do_scale=True, do_translation=True, auto_bring_to_front=False, scale=1) self.ids.boxlayout_image.add_widget(self.myorigin) # segment 된 색칠하려는 (canvas) 이미지 표현하기. self.mycanvas = MyCanvas(do_rotation=False, do_scale=True, do_translation=True, auto_bring_to_front=False, scale=2) self.mycanvas.bind(on_touch_down=self.mycanvas.paint_color) self.mycanvas.bind(on_touch_move=self.mycanvas.limit_area) self.ids.boxlayout_image.add_widget(self.mycanvas) def sync_scatters(self, touch): self.ids.origin_image = touch def save_painting(self, touch): print('save painting') def compelete_painting(self, touch): print('complete painting') # painting 화면에서 다시 갤러리 화면으로 돌아갈때. def clear_painting_widgets(self): self.color_data.clear() # self.clear_widgets(children=(self.mycanvas.img).all()) self.ids.boxlayout_image.clear_widgets() self.mycanvas.clear_widgets() self.myorigin.clear_widgets() self.remove_widget(self.mycanvas) self.remove_widget(self.myorigin) self.ids.button_layout.clear_widgets() try: self.remove_widget(self.md_app_bar) except AttributeError: pass # self.complete_button.clear_widgets() # self.save_button.clear_widgets() # self.remove_widget(self.mycanvas) # self.remove_widget(self.myorigin) # self.remove_widget(self.palette) # self.remove_widget(self.mycanvas.canvas_img) # self.remove_widget(self.complete_button) # self.remove_widget(self.save_button) # self.remove_widget(self.mycanvas) # self.remove_widget(self.myorigin) # self.remove_widget(self.palette) # self.remove_widget(self.mycanvas.canvas_img) # self.mycanvas.img.empty() # self.remove_widget(self.complete_button) # self.remove_widget(self.save_button) # self.remove_widget(layout) # self.remove_widget(_button_layout) # self.remove_widget(scrollview) # self.remove_widget(self.palettecolors) print('destroyed painting') def callback(self, obj): print(obj.source) # self.selectedImagePath = obj.source # _save_file = (Image.open(self.selectedImagePath)).crop() # _save_file.save('Data/temp.png') self.parent.current = 'gallery'
# =========================== # Control The Backlight # =========================== def Backlight_Control(light_status): subproces.call('echo 0 > Light.SATUS') # ======================== # Load the Defaults # ======================== config = ConfigParser() config.read('doorbell.ini') CODES = ConfigParser() CODES.read('codes.ini') CODES_DICT = {s:dict(CODES.items(s)) for s in CODES.sections()} NUMBERS = ConfigParser() NUMBERS.read('numbers.ini') NUMBERS_DICT = {s:dict(NUMBERS.items(s)) for s in NUMBERS.sections()} LANGUAGES = ConfigParser() LANGUAGES.read('languages.ini') LANGUAGES_DICT = {s:dict(LANGUAGES.items(s)) for s in LANGUAGES.sections()} # =========================== # Load the Sound Effects # =========================== Sound_Click = SoundLoader.load(config.get('Sounds','Sound_Click'))
class Effects(Screen): events_callback = ObjectProperty(None) sets = ObjectProperty(None) title_previous = StringProperty('') # 액션바 selectedImagePath = StringProperty('') def __init__(self, **kwargs): super(Effects, self).__init__(**kwargs) self.pos = (0, 0) self.size_hint = (1, 1) self.config = ConfigParser() # effect 효과의 타이틀명, 샘플이지미파일, 효과 프로그램명 정보 읽어오기 def _get_effects(self): self.config.read(os.path.join(directory, 'Libs/mangopaint.ini')) _items = self.config.items('Effects') for key, _item in _items: img_sh = _item.split(',') _data = { 'key': key, 'image': img_sh[0], 'pgm': img_sh[1], 'order': img_sh[2] } self.effects_data.list.append(_data) # effects.kv 에서 호출하는 effects 화면 생성하기 def create_effects_screen(self, imagePath): self.effects_data = Box() self.effects_data.pos = 0 self.effects_data.list = [] self._get_effects() self.effects_data.list.sort(key=lambda x: int(x['order'])) self.effectsbar = EffectsBar(meta=self.effects_data) self.selectedImagePath = imagePath self.ids.myimage.source = self.selectedImagePath # self.container.add_widget(self.effectsbar.ret_scrollview) self.add_widget(self.effectsbar, index=0) # effectsbar 화면 랜더링 # def update_effectsbar(self): # self.effectsbar.update() # ########################################### # effect 효과를 적용하도록 화면 변경하가 # ########################################### def transform_to_image(self, image_pos): self.effects_data.pos = image_pos _data = self.effects_data.list[image_pos] cmd = [] # if 조건이 exclusive 하지 않아 혹 조건을 빠져나갈수 있는 위험이 있으니 주의할것! # 우선 뉴럴스타일이면, 다음으로 특정스타일을 물어보는 식이라... if _data.pgm == 'neural_style.py': args, output = self.neural_style_arguments(image_pos, _data.key) elif _data.key == 'edge_detect': args, output = self.edge_detect_arguments(image_pos) elif _data.key == 'water_color': args, output = self.water_color_arguments(image_pos) elif _data.key == 'oil_color': args, output = self.oil_color_arguments(image_pos) else: args, output = self.edge_detect_arguments(image_pos) cmd.append(sys.executable or 'python3') cmd.append(args) print(cmd[0] + cmd[1]) process = Popen(cmd[0] + cmd[1], shell=True, stdout=PIPE, stderr=STDOUT) out, err = process.communicate() self.ids.myimage.source = output print('effect function end: ' + _data.key + ' <==================') self.ids.myimage.reload() # 뉴럴스타일 방식의 패턴은 아래 함수로 집중 def neural_style_arguments(self, image_pos, key): # python3 ./fast_neural_style/neural_style.py eval --content-image ../../../images/Colorful-Paint-with-Paper-Texture.jpg --model ./fast_neural_style/saved_models/mosaic.model --output-image ../Data/temp.png --cuda 0 _pgm = os.path.join(directory, 'Effects/fast_neural_style', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') _cuda = 1 _model = os.path.join(directory, 'Effects/fast_neural_style/saved_models', key + '.model') args = " {} eval --content-image {} --model {} --output-image {} --cuda {}".format( _pgm, self.selectedImagePath, _model, output, _cuda) return args, output # 흑백 스케치 느낌 (아직은 칼라네요....) def edge_detect_arguments(self, image_pos): # python3 edge_detecting.py --content=$1 --output=$2 --blurred=$3 # python3 edge_detecting.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_edge_result.png" --blurred 3 _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {} --blurred {}".format( _pgm, self.selectedImagePath, output, 3) return args, output # 유화 느낌 def oil_color_arguments(self, image_pos): # python oil_painting.py --content=$1 --output=$2 --radius=$3 --intensity=$4 # python3 oil_coloring.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_oil_result.png" --radius 5 --intensity 20 _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {} --radius {} --intensity {}".format( _pgm, self.selectedImagePath, output, 5, 20) return args, output # 수채화 느낌 def water_color_arguments(self, image_pos): # python3 Water_coloring.py --content=$1 --output=$2 # python3 water_coloring.py --content "../../../images/mosaic.jpg" --output "../Data/mosaic_water_result.png" _pgm = os.path.join(directory, 'Effects', self.effects_data.list[image_pos].pgm) output = os.path.join(directory, 'Data', 'temp.png') args = " {} --content {} --output {}".format(_pgm, self.selectedImagePath, output) return args, output # effects 화면에서 다시 갤러리 화면으로 돌아갈때. def remove_effects_widgets(self): print('destroyed') self.effects_data.clear()