当前位置: 首页>>代码示例>>Python>>正文


Python image.imsave方法代码示例

本文整理汇总了Python中matplotlib.image.imsave方法的典型用法代码示例。如果您正苦于以下问题:Python image.imsave方法的具体用法?Python image.imsave怎么用?Python image.imsave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.image的用法示例。


在下文中一共展示了image.imsave方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_chunk

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def do_chunk(pid,filelist):
    for co,row in enumerate(filelist):
      try:
        if co%1000==0:
          print(co)
          sys.stdout.flush()
        img=mpimg.imread(row)
        img=scipy.misc.imresize(img[0:-100,:],(256,256))
        path=dst_dir+str(row[len(src_dir):row.rfind('/')])

        if not os.path.exists(path):
          os.makedirs(path)
        mpimg.imsave(dst_dir+row[len(src_dir):],img)
      except:
        print 'Severe Error for'+row
        #raise
    print("Process "+str(pid)+"  is done") 
开发者ID:Evolving-AI-Lab,项目名称:deep_learning_for_camera_trap_images,代码行数:19,代码来源:resize.py

示例2: imsave

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def imsave(*args, **kwargs):
    return _imsave(*args, **kwargs) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:pyplot.py

示例3: show

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def show(self):
        fig = plt.figure()
        imgplot = plt.imshow(self.env.render(mode = 'image'))
        def press(event):
            def redraw():
                plt.imshow(self.env.render(mode = 'image'))
                fig.canvas.draw()

            if event.key == 's':
                mpimg.imsave("output.png",self.env.render(mode = 'image'))
            elif event.key == 'up':
                self.env.step('MoveAhead')
                redraw()
            elif event.key == 'right':
                self.env.step('RotateRight')
                redraw()
            elif event.key == 'left':
                self.env.step('RotateLeft')
                redraw()

            pass

        plt.rcParams['keymap.save'] = ''
        fig.canvas.mpl_connect('key_press_event', press)
        plt.axis('off')
        plt.show() 
开发者ID:jkulhanek,项目名称:visual-navigation-agent-pytorch,代码行数:28,代码来源:explorer.py

示例4: test

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def test():
    print('Test read data')
    dataset = ucf11.get_split('test', 'data/UCF11-tfrecord')
    input, label = ucf11.build_data(dataset, 'train',batch_size=BATCH_SIZE)

    new_input = off_preprocessing.preprocess_image(input, 240, 240, is_training=True)

    example_queue = tf.FIFOQueue(
        3 * BATCH_SIZE,
        dtypes=[tf.float32, tf.uint8, tf.int32],
        shapes=[_OUTPUT_SHAPES, _ORIGINAL_OUTPUT_SHAPES, []]
    )
    num_threads = 1

    example_queue_op = example_queue.enqueue([new_input, input, label])
    tf.train.add_queue_runner(tf.train.queue_runner.QueueRunner(
        example_queue, enqueue_ops=[example_queue_op] * num_threads))

    new_inputs, inputs, labels = example_queue.dequeue_many(BATCH_SIZE)

    new_images = tf.unstack(new_inputs, axis=0)

    print(new_images[0])

    fx, fy = sobel(new_images[0])

    spax = tf.unstack(fx, axis=0)
    spay = tf.unstack(fy, axis=0)

    print(fx)
    print(fy)
    print(spax)

    with tf.Session() as sess:
        tf.train.start_queue_runners(sess)
        sx, sy, l = sess.run([spax[0], spay[0], labels])
        for i in range(sx.shape[2]):
            image.imsave('%d_fx%d' % (l[0], i), sx[:,:,i], cmap='gray')
            image.imsave('%d_fy%d' % (l[0], i), sy[:,:,i], cmap='gray') 
开发者ID:reallongnguyen,项目名称:Optical-Flow-Guided-Feature,代码行数:41,代码来源:test_convert_ucf11.py

示例5: _plot_and_save

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def _plot_and_save(self, src_path, class_entities, boxes):
        src_path = src_path.decode('ascii')
        img = mpimg.imread(src_path)
        shape = img.shape
        for ce, b in zip(class_entities, boxes):
            ce = ce.decode('ascii')
            s1, s2, s3, s4 = int(b[1] * shape[1]), int(b[0] * shape[0]), int(b[3] * shape[1]), int(b[2] * shape[0])
            cv2.rectangle(img, (s1, s2), (s3, s4), (0, 255, 0), 10)
            cv2.putText(img, ce, (s1, s2), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 2)

        dst_path = os.path.join(self._save_path, os.path.basename(src_path))
        mpimg.imsave(dst_path, img) 
开发者ID:Prasad9,项目名称:TFHubSample,代码行数:14,代码来源:Infer.py

示例6: _save_images

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def _save_images(self, images):
        for save_index, image in enumerate(images, self._save_index_at):
            save_path = os.path.join(self._save_path, '{:05d}.jpg'.format(save_index))
            mpimg.imsave(save_path, image)

        self._save_index_at += len(images) 
开发者ID:Prasad9,项目名称:TFHubSample,代码行数:8,代码来源:Infer.py

示例7: _save_image

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def _save_image(self, image, file_path, run_no):
        file_path = file_path.decode('ascii')
        file_name = os.path.splitext(os.path.basename(file_path))[0]
        dst_file_path = os.path.join(self._dst_folder_path, '{}_{}.jpg'.format(file_name, run_no + 1))
        mpimg.imsave(dst_file_path, image) 
开发者ID:Prasad9,项目名称:TFHubSample,代码行数:7,代码来源:Augment.py

示例8: getImagePath

# 需要导入模块: from matplotlib import image [as 别名]
# 或者: from matplotlib.image import imsave [as 别名]
def getImagePath(self, img_obj):
        buffer = io.BytesIO()
        mpimg.imsave(buffer, img_obj)
        try:
            mpimg.imsave(buffer, img_obj)
        except Exception:
            logging.error("Error: getImage method must return an image object")
        return(buffer) 
开发者ID:adamhajari,项目名称:spyre,代码行数:10,代码来源:model.py


注:本文中的matplotlib.image.imsave方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。