Cylindrical projection from image normal coordinates

4 ビュー (過去 30 日間)
Preetham Manjunatha
Preetham Manjunatha 2021 年 8 月 1 日
編集済み: Preetham Manjunatha 2021 年 8 月 1 日
I am trying to project normal image coordinates to cylindrical projection using the MATLAB's
imwrap
function. But the output image is terrible.
fileName = 'peppers.png';
image = imread(fileName);
f = 200;
[h, w, bypixs] = size(image);
K = [f,0,w/2; 0,f,h/2; 0,0,1];
x = 1:w;
y = 1:h;
[X,Y] = meshgrid(x,y);
X = X';
Y = Y';
XYZ = [X(:) Y(:) ones(h*w,1)];
XYZnew = (K \ XYZ')';
A = [sin(XYZnew(:,1)), XYZnew(:,2), cos(XYZnew(:,1))];
B = (K * A')';
% back from homog coords
B = B(:,1:2) ./ B(:,3);
% Make sure warp coords only within image bounds
B((B(:,1) < 0) | (B(:,1) >= w) | (B(:,2) < 0) | (B(:,2) >= h),:) = -1;
B = pagetranspose(reshape(B, w, h, 2));
% Image warp
Icy = imwarp(image, B, 'FillValues', [0 0 0]);
% Display warped image
figure;
subplot(1,2,1); imshow(image)
subplot(1,2,2); imshow(Icy)
Below is the output image:
Any inputs to solve this issue is much appreciated!
  2 件のコメント
Matt J
Matt J 2021 年 8 月 1 日
What should it look like? What is a cylindrical projection?
Preetham Manjunatha
Preetham Manjunatha 2021 年 8 月 1 日
編集済み: Preetham Manjunatha 2021 年 8 月 1 日
It should look like this:
Above image has transparent background, in my case it is black. Cylindrical projection is a mapping from the Cartesion (or any) to Cylindrical coordinates. Here I am trying to warp the given normal/regular image to Cylindrical coordinates to get better panaroma stitching.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing and Computer Vision についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by