I have the following image:
In this image there are 5 more or less vertical peaks in total. Let the x-axis be the horizontal axis and y-axis be the vertical axis. I would like to determine the distance between the center of the most intense peak (peak in the middle of the image) and the centers of the 4 symmetrically surrounding peaks for every given y-value. So that I know the distance of these peak-centers as a function of y.
For reasons of testing the code, I have selected a smaller area in the original image file:
Within my code this image is called: testlong.jpg
My code so far:
img2 = Import["filepath\\testlong.jpg"]; data2 = ImageData[img2]; Dimensions[data2] For[column = 1, column < 83, column++, pc[column] = Position[data2[[All, column]], Max[data2[[All, column]]]]; pb[column] = Position[data2[[1 ;; 60, column]], Max[data2[[1 ;; 60, column]]]]; pt[column] = 239 + Position[data2[[240 ;; 282, column]], Max[data2[[240 ;; 280, column]]]];]; For[lauf = 1, lauf < 83, lauf++, pcflat[lauf] = Flatten[pc[lauf]]]; For[lauf = 1, lauf < 83, lauf++, pbflat[lauf] = Flatten[pb[lauf]]]; For[lauf = 1, lauf < 83, lauf++, ptflat[lauf] = Flatten[pt[lauf]]];
Now what's to do is to plot pcflat, ptflat, pbflat, fit each one with a line of best fit and determine the distance between these lines. But I don't seem to be able to plot pcflat, ptflat, pbflat. If I use:
Mathematica plots 3 points within the interval [1,2]
The problem is, that pcflat, pbflat, etc are nested lists with unequal length, because some x-values correspond with more than one y-value where there is a maximum (peaks are not delta peaks but have a width). How do I plot that?