python ndimage.gaussian_Python ndimage:将现有的ndarray转换为灰色

这篇博客介绍了如何使用Python的scipy库中的ndimage模块对图像进行模糊和灰度处理。通过提供的脚本,用户可以选择对图像应用模糊效果或转换为灰度。然而,作者遇到一个问题,在尝试将模糊处理后的浮点型图像保存为PNG格式时遇到了错误。错误提示是无法将模式'F'的图像写入PNG。博客寻求解决方案。
摘要由CSDN通过智能技术生成

在我尝试使用scipy的python2.7探索过程中,我编写了以下简单的脚本:#!/usr/bin/env python

# coding=utf-8

# -*- Mode: python; c-basic-offset: 4 -*-

from scipy import ndimage

import numpy as np

from scipy import misc

import argparse

import Image

def getArguments():

parser = argparse.ArgumentParser(description="An simple Image processor")

parser.add_argument('image_file', metavar="FILENAME", type=str,

help="The image file that will be read In order to be processed")

return parser.parse_args()

def getImagePathFromArguments():

'''

:return: string

'''

args = getArguments()

return args.image_file

def loadImage(image):

'''

:param image: The path of the Image

:return:

''

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值