line profile on rotated image

5 visualizzazioni (ultimi 30 giorni)
Jason
Jason il 4 Mar 2016
Commentato: Image Analyst il 16 Mar 2016
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

Risposte (1)

Image Analyst
Image Analyst il 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 Commenti
Jason
Jason il 16 Mar 2016
Modificato: Jason il 16 Mar 2016
The image is only slightly misaligned (rotated) - about 0.26 degrees. A line scan starting at the centre of the image, by the time it reaches the left hand side image has crossed on line of spots.
I do the Synthesizing once I have the intensity profile along the centre of one row of spots. I then use this to calculate distortion (actual "x" location minus real "x" location)
By its nature, distortion gets worse the further from the centre you are, so I'm not convinced that using imregister is the best way as it may be possible to "get out of synch" with the current object and align to the adjacent one.
the reason I like the "improfile" approach is that I directly create a linescan that incorporates the image rotation. I then find the peaks on this profile. Then I generate what the "real" locations should be and subtract these two measurements. These two measurements for a very small FOV are shown below.
where I'm struggling is generating the improfile coordiantes. i start at the centre of field of view, align to nearest object. what I want to do, but can't yet, is to move horizontally away from the starting location, and record the x location of any peaks, but allow for an adjustment in y to find the true location of x - to account for image rotation.
Image Analyst
Image Analyst il 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.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by