How to rotate polar radius to boundaries?

1 visualizzazione (ultimi 30 giorni)
SL il 21 Ott 2016
I am thinking if there is any method to rotate origo to boundaries and boundaries to origo. The related thread has the relevant code and example about the situation. My pseudocode is
  1. put mirror on the boundaries
  2. mirror the all points outside of the circle
  3. shrinkage now the empty space in the circle; the points should now be in the circle
I think there exists mathematically more rigorous way to do it. The related thread is about Mathematics of the case. However, there may be already something relevant integrated in MATLAB.
close all; clear all; clc;
fp2 = figure('Name', 'Test YX', ...
'Position',[200 200 851 404],'Resize','off'); % only half circle in polaraxes although warp can do eclipses
ThetaTicks = 0*pi:pi/10:2*pi;
pax2 = polaraxes( 'ThetaAxisUnits', 'radians', ...
'ThetaLim',[min(ThetaTicks) max(ThetaTicks)],...
'GridColor',[1 1 1],...
'ThetaTick',ThetaTicks, ...
'Parent', fp2);
I = imread('');
imax2 = axes('Parent', fp2, 'Visible', 'off');
[x, y, z]=makePolar(I, angleRadians);
imax2.Children = warp(x, y, z, I);
set(imax2,'view',[-180 -90],'Visible','off')
function [x, y, z]=makePolar(img, angleRadians)
[h,w,~] = size(img);
s = min(h,w)/2;
[rho,theta] = meshgrid(linspace(0,s-1,s), linspace(0,angleRadians,s));
[x,y] = pol2cart(theta, rho);
z = zeros(size(x));
MATLAB: 2016b OS: Debian 8.5 Related:

Risposte (0)



Community Treasure Hunt

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

Start Hunting!

Translated by