'extract intensity profile along a line from image

ch4-out is the sample imageI have a numpy array that contains some image data (ch4_out). Now, I want to extract intensity profile along a particular line (horizontal). I am using profile_line function from skimage module to do this, but I am getting error. I am seeking some help to resolve my code.

error displayed is

order = _validate_interpolation_order(image.dtype, order)

# reading multiple images 
S01=[i for i in 
glob.glob("C:/Users/experiment/S01/*.tif")]

# Averaging images
ch4=np.array([np.array(Image.open(fname)) for fname in
S01])
ch4_avg=np.array(np.mean(ch4,axis=(0)),dtype=np.uint16)
ch4_out=Image.fromarray(ch4_avg) # image data as numpy array

#plotting figure
plt.figure()
plt.subplot(1,2,1)
plt.imshow(ch4_out,cmap='gray',interpolation='none') 
#code works fine until this point

#Now, extract intensity profile at pixel along horizontal line x (2 to 1000) at a height in vertical direction of 730 
pixels

p = profile_line(ch4_out, (2, 1000), (730, 730)) 
# coordinates for horizontal (2,1000) and vertical 
(730,730))
plt.imshow(p)
plt.show()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source