How to remove bulbs in the mouse trajectory?
Mostrar comentarios más antiguos
I am trying to remove the bulbs in red circles in the picture to get a smooth trajectory as shown in the picture.

The mouse may be sitting or rotating in those bulbs. My goal is to find the number of pixels (I can define my own pixel size) moved in their trajectory in the smooth profile.
I tried to divide the 2-D histogram with 50x50 bins and count the number of bins which are nonzero. Then I smoothed X and Y and plotted a 2-D histogram with 100x100 bins. I expected the number of nonzero bins to be higher in image 1 so that the number of pixels is more there. So clearly this method is not working. I have attached my code here.
How should I approach this problem?
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 3 de Jul. de 2022
Editada: Image Analyst
el 3 de Jul. de 2022
0 votos
Would a good algorithm be that if there is a stretch of (x,y) coordinates where the x values were all contained in a certain delta X range then we can replace the range with the interpolated path from the start of the window to the end of the window?
Another way would be to write the path to a digital image and then use morphological methods to get rid of the bulb. You'd need to specify a size for the image that wuold depend on how much spatial precision you require (like as long as we're within 1 mm of the actual location, we'll accept that).
Or you can try smoothing the trace with a Savitzky-Golay filter sgolayfilt, like in my attached demo.
Or how about if you did a cluster analysis like kmeans and if any points identified as being in the cluster were within a certain distance of the cluster centroid, find the first index and last index in the main array and interpolate a straight line between them.
Categorías
Más información sobre HDL-Optimized Algorithm Design en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
