Find cross section of 2d plot (tilted matrix/image)
Show older comments
Dear MATLAB community,
I do sometimes measurements of the near-field of a laser diode. For high power lasers, the measurement looks like the "2D_Image.jpg" attached. It looks like a stripe of brightness. I am interested in the lateral cross section of that stripe. Usually, when the laser is placed flat, I can just find the max peak and draw the line corresponding to the row index of that point. It would give me something like the "Cross_Section.jpg" attached. However, as we can see in the 2D image, sometimes the camera or the laser are misaligned and it is not flat. Is there a way to automatically find the cross section when the measurement turns out tilted like that, without having to guess the tilted angle (which is never the same) and rotate the image? I also do not have the image processing toolbox.
Thank you very much!
Thiago


Answers (1)
Image Analyst
on 21 Apr 2017
Edited: Image Analyst
on 21 Apr 2017
1 vote
Pretty easy. Just use the radon transform to compute the projection of all angles at once. Then pick whichever angle gives you the highest peak. It will be the mean perpendicular profile that you're looking for. I can't do it for you because you didn't attach the original image, just the pseudocolored one. You need to use the original image.
For what it's worth, I'm attaching a different demo of radon() where I project the image, determine the angle, and use it to unrotate/straighten the image. NOTE: you do NOT need to rotate your image to get it's cross sectional profile - the radon transform is the profile directly. Good luck.
By the way your image does not have 1600 pixels in any direction so I don't know how you got that 1600 element long profile you posted.
3 Comments
Thiago Melo
on 24 Apr 2017
Thiago Melo
on 24 Apr 2017
Image Analyst
on 24 Apr 2017
Not sure how to help if you don't have the Image Processing Toolbox. Another way is to get the intensity profile between two points with improfile(), but that requires the toolbox too.
I guess you'll have to somehow do it manually with interp1 or interp2(), though I'm not sure how. You might check out the Bresenham line algorithm in Wikipedia.
Categories
Find more on ROI-Based Processing 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!