Note: I changed the first parameter to folder because input is a reserved word in python.
Whereas in the IJ1 macro language you always rely on the current active image, in all scripting languages you should assign a variable whenever possible, so this becomes:
imp = IJ.openImage(folder + filename)
or, using Python’s os module, making it safer to join paths:
imp = IJ.openImage(os.path.join(folder,filename))
This imp variable can be used by all commands that change the image in the following.
IJ.run(imp, "Smooth", "")
IJ.run(imp, "Sharpen", "")
Prefs.blackBackground = False # here I needed to change 'false' to 'False' in Python
IJ.run(imp, "Convert to Mask", "")
IJ.run(imp, "Analyze Particles...", "display summarize")