How to convert omnidirectional/ 360 degree image into rectangular form?

4 views (last 30 days)
I wanted to convert 360 image into rectangular form. My image is like this type

Accepted Answer

Image Analyst
Image Analyst on 8 Aug 2020
What I'd do is to find the inner and outer radii. Lots of ways to do that but you can just take a guess if you want. Then convert those into xInner and yInner and xOuter and yOuter using sin() and cos().
numAngles = 2 * pi * outerRadius;
angles = linspace(0, 2*pi, numAngles);
xOuter = outerRadius * cos(angles);
yOuter = outerRadius * sin(angles);
Then I'd go down the xouter arrays using improfile() to get the intensity along each ray. Then put that into a column of your output matrix. Not hard - give it a try.
for k = 1 : length(xOuter)
x2 = xOuter(k);
y2 = yOuter(k);
x1 = rows/2;
y1 = columns/2;
p = improfile(x1,y1,x2,y2)
outputImage(k, :, :) = p;
end
That won't work as is and that's intentional - I've left the fun parts for you because I assume you want to solve this puzzle yourself to have some pride of ownership. See if you can get it to work. It's really not hard.
  1 Comment
Image Analyst
Image Analyst on 8 Aug 2020
You can also use pol2cart() and meshgrid() like someone will undoubtedly suggest, but there's problems with that method, as you'd find out if you tried it.

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!