image - Average Picture of float Pictures Python -


I want to do something like this post:

I have given the code given to work How can I change? Float pictures in "Tiff" - format?

This is what I have tried:

  Importing OS, Oval, PIL import from PIL image # All PNG files in the directory. Os.chdir ("c: // users // Student /// Desktop // Builder // "Print" is working:% s "% os.getcwd () allfiles = os.listdir (os.getcwd ()) Imlist = [in all files File name for file name if file name [-5:] [".tiff", ". Tiff"]] # imlist = [file name for file name in all files] # All images have similar sizes assuming , Get the dimension First Image W, H = Image.Open (IMlist [0]) Size N = len (ISL) # RGB images (RGB images value) arr = numpy.zeros ((H, W, 1), numpy.float ) # Average pixel intensities, cast each image as an array of float for IM in ISL: imarr = numpy.array (Image.open (im), dtype = numpy.float) arr + = imarr / n # Enter the round value and the 8-bit integer array = numpy.array in the array (num, round, dtype = numpy.uint8) # Save the image, save and reuse the previous image Make it = Image.fromarray (arr, mode = "F") out.save ("Average.tiff") out.show ()  

This error produces:

  file "C: \ user \ student \ im_average.py", line 25, in & lt; Module & gt; Arr + = imarr / n Value Error: Non-broadcastable output with size (250,250,1) does not match broadcast size (250,250,250)  

I'm not familiar with numpy arrays, Therefore any help is welcome.

The IRRR / N will make it in place and the array will convert DTH to integer array. So, use N = float (n)

Please note that due to the assignment, high types of lower types (such as floats in the interses) or exception (assigning complex to floats or inters).


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -