'plot Intensity profile row by row for an image
I know how to extract intensity profile along a particular line of an image using profile_line function in skimage module. For example I have an image having dimensions 1024X1024, I simply use the following code to extract intensity profile along pixel corresponding to 500th row.
from skimage.measure import profile_line
image=io.imread('sample.jpg') #read sample image
profile = profile_line(image,(500,2),(500,image.shape([1])) # intensity profile at row corresponding to pixel position 500
plt.plot(profile) #plot of intensity profile
Now, I want to plot intensity profile at each row and save maximum value of intensity profile at each row in a variable called max_I. I have written a sample code, but I have to change index every time to get intenstity profile for each row, which means i have to type 0 - 1024 to get intensity profile at each pixel row. Can this code be improved, so that I don't have to physically type in the rows.
array=[list(range,Image.shape[0])] #create an array having entries from 1 to 1024 (height of image)
for sublist in array:
intensity_profile=profile_line(I,(sublist[0],2),(sublist[0],I.shape[1])) # intensity profile at first pixel row
plt.plot(intensity_profile)
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 |
|---|
