line profile on rotated image
5 views (last 30 days)
Show older comments
Hi, I have an image of about 4000 pixels wide and I want to perform a line scan through the centre (cyan line below)and obtain the intensity profile. My image is slightly twisted. I have tried imrotate but had to do it manually. Is there an automated way where I can for example use the improfile function to create a line on my image so that it goes through the same line of then objects.

in the picture above, you can clearly see that the right hand edge and left hand edge show the cyan line which represents the features in the centre of image, but they depart from the line due to image rotation.
This picture illustrates it a bit better

This just represents a small portion of my image, in reality, the departure from the cyan line at the extreme edges is several features in the y direction.
Thanks for any ideas how I can correctly obtain a line profile. thanks Jason
0 Comments
Answers (1)
Image Analyst
on 13 Mar 2016
You can use the radon transform to discover the optimum angle to rotate the image. Then you can just take rows from that to get the profile. I attach an example where I used the radon transform to find the angle and rotate the image.
4 Comments
Image Analyst
on 16 Mar 2016
What I'm saying is to take one image and align it somehow, or synthesize one. So you have one image that you know for a fact is perfectly aligned with the rows. Then use imregister on all the rest of the images to align with that perfectly aligned one. Then you can simply extract rows from the now aligned image. I would think that should work unless your distortion is so extreme that the outer spots maybe nowhere near the reference outer spots while the central ones are pretty much in the same place. In that case you might have to do a rubber sheet stretch with imwarp.
Alternatively just measure the weighted centroids and pass the y values into kmeans() in the Statistics and Machine Learning Toolbox. There are ways to use kmeans to figure out what the best k is if you don't know the number of rows. So now you know the number of rows and you can extract all blobs that have a y value between the cluster mean y values. So now all those spots are on the same line. (I do this very thing for finding chips on an X-rite ColorChecker chart.) Now you can interpolate a path between all the centroids and extract the intensities along that path.
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
