Python util.util.save_image() Examples

The following are 4 code examples of util.util.save_image(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module util.util , or try the search function .
Example #1
Source File: main_gui_shadow_draw_sketchy.py    From iSketchNFill with GNU General Public License v3.0 6 votes vote down vote up
def generate(self):
        #pass
        data=self.get_network_input()
        model.set_input(data)
        visuals=model.get_latent_noise_visualization()

        image_dir='./imgs'
        for label,image_numpy in visuals.items():
            image_name='test_%s.png' % (label)
            save_path=os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)
        ## convert back from pil image to cv2 image


        if self.enable_shadow:
            cv2_img = cv2.imread('imgs/test_fake_B_shadow.png')
        else:
            cv2_img = cv2.imread('imgs/test_%d_L_fake_B_inter.png'%(self.which_shadow_img))

        self.drawWidget.setShadowImage(cv2_img)

        self.visWidget.update_vis('imgs/fake_B_gallery.png') 
Example #2
Source File: main_gui_shadow_draw_sketch.py    From iSketchNFill with GNU General Public License v3.0 6 votes vote down vote up
def generate(self):
        #pass
        data=self.get_network_input()
        model.set_input(data)
        visuals=model.get_latent_noise_visualization()

        image_dir='./imgs'
        for label,image_numpy in visuals.items():
            image_name='test_%s.png' % (label)
            save_path=os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)
        ## convert back from pil image to cv2 image

        if self.enable_shadow:
            cv2_img = cv2.imread('imgs/test_fake_B_shadow.png')
        else:
            cv2_img = cv2.imread('imgs/test_%d_L_fake_B_inter.png'%(self.which_shadow_img))

        self.drawWidget.setShadowImage(cv2_img)

        self.visWidget.update_vis('imgs/fake_B_gallery.png') 
Example #3
Source File: main_gui_shadow_draw_pix2pix.py    From iSketchNFill with GNU General Public License v3.0 5 votes vote down vote up
def generate(self):
        #pass
        data=self.get_network_input()
        model.set_input(data)
        visuals=model.get_latent_noise_visualization()

        image_dir='./imgs'
        for label,image_numpy in visuals.items():
            image_name='test_%s.png' % (label)
            save_path=os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)
        ## convert back from pil image to cv2 image

        if self.enable_shadow:
            cv2_img = cv2.imread('imgs/test_fake_B_shadow.png')
        else:
            cv2_img = cv2.imread('imgs/test_%d_L_fake_B_inter.png'%(self.which_shadow_img))

        cv2_img = cv2.resize(cv2_img,(self.img_size,self.img_size))
        self.drawWidget.setShadowImage(cv2_img)



        data = self.get_network_input_color()
        model_color.set_input(data)
        model_color.test()
        visuals = model_color.get_current_visuals()

        image_dir = './imgs'

        for label,image_numpy in visuals.items():
            image_name = 'test_color_%s.png' % (label)
            save_path = os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)

        self.visWidget_color.update_vis('imgs/test_color_fake_B.png') 
Example #4
Source File: main_gui_shadow_draw_color.py    From iSketchNFill with GNU General Public License v3.0 5 votes vote down vote up
def generate(self):
        data=self.get_network_input()
        model.set_input(data)
        visuals=model.get_latent_noise_visualization()

        image_dir='./imgs'
        for label,image_numpy in visuals.items():
            image_name='test_%s.png' % (label)
            save_path=os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)
        ## convert back from pil image to cv2 image

        if self.enable_shadow:
            cv2_img = cv2.imread('imgs/test_fake_B_shadow.png')
        else:
            cv2_img = cv2.imread('imgs/test_%d_L_fake_B_inter.png'%(self.which_shadow_img))

        cv2_img = cv2.resize(cv2_img,(self.img_size,self.img_size))
        self.drawWidget.setShadowImage(cv2_img)


        data = self.get_network_input_color()
        model_color.set_input(data)
        model_color.test()
        visuals = model_color.get_current_visuals()

        image_dir = './imgs'

        for label,image_numpy in visuals.items():
            image_name = 'test_color_%s.png' % (label)
            save_path = os.path.join(image_dir,image_name)
            util.save_image(image_numpy,save_path)

        self.visWidget_color.update_vis('imgs/test_color_fake_B.png')