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

2 次查看(过去 30 天)
I wanted to convert 360 image into rectangular form. My image is like this type

采纳的回答

Image Analyst
Image Analyst 2020-8-8
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 个评论
Image Analyst
Image Analyst 2020-8-8
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by