Script tool

733
1
04-18-2014 11:41 AM
MaherAL_ZUHAIRI
New Contributor
Hello,
excuse me can someone make this code for me a script tool, I do not know what is the problem with me...
the code is working in python window...



import scipy.ndimage as ndi
import scipy
import numpy
import Image
import math
import arcpy
inpRaster= arcpy.GetParameterAsText(0)
sigma= arcpy.GetParameter(1)
desc = arcpy.Describe(inpRaster)
f = desc.catalogPath
img = Image.open(f).convert('L') #grayscale
imgdata = numpy.array(img, dtype = float)
G = ndi.filters.gaussian_filter(imgdata, sigma)
scipy.misc.imsave('D:\SEMETER ONE\DIGITAL IMAGE PROCESSING\Edge Detection Project\G.jpg', G)

please if you know the reason way the script tool do not save the result( output ) infer me.
thank you...
Tags (2)
0 Kudos
1 Reply
Luke_Pinner
MVP Regular Contributor
In python the back slash \ in a literal string is a special character. Use forward slashes / or escaped backslashes \\ or raw string notation r"".

Eg
scipy.misc.imsave('D:/path/to/save/to') 
scipy.misc.imsave('D:\\path\\to\\save\\to') 
scipy.misc.imsave(r'D:\path\to\save\to')
0 Kudos