Changeset 1129 for trunk/src/uvmat.m
- Timestamp:
- Mar 1, 2024, 8:09:20 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1127 r1129 1657 1657 1658 1658 %% rescale the image 1659 [nby,nbx]=size(UvData.Field.A);1660 x=linspace(UvData.Field.Coord_x(1),UvData.Field.Coord_x(2),nbx)-nbx/2;1661 y=linspace(UvData.Field.Coord_y(1),UvData.Field.Coord_y(2),nby)-nby/2;1662 [X,Y]=meshgrid(x,y);1659 % [nby,nbx]=size(UvData.Field.A); 1660 % x=linspace(UvData.Field.Coord_x(1),UvData.Field.Coord_x(2),nbx)-nbx/2; 1661 % y=linspace(UvData.Field.Coord_y(1),UvData.Field.Coord_y(2),nby)-nby/2; 1662 % [X,Y]=meshgrid(x,y); 1663 1663 %coeff_quad=0.15*4/(nbx*nbx);% image luminosity reduced by 10% at the edge 1664 1664 %UvData.Field.A=double(UvData.Field.A).*(1+coeff_quad*(X.*X+Y.*Y)); … … 1686 1686 ylabel('radius from light source') 1687 1687 title('ref line in polar coordinates') 1688 azimuth_ima=linspace(DataPol.Coord_y(1),DataPol.Coord_y(2),size(DataPol.A,1))-360;%array of angular indices on the transformed image 1689 dist_source = interp1(theta_ref,r_ref,azimuth_ima);% get the polar position of the reference line 1690 dist_source_pixel=round(size(DataPol.A,2)*(dist_source-DataPol.Coord_x(1))/(DataPol.Coord_x(2)-DataPol.Coord_x(1))); 1688 %azimuth_ima=linspace(DataPol.Coord_y(1),DataPol.Coord_y(2),size(DataPol.A,1));%array of angular indices on the transformed image 1689 % dist_source = interp1(theta_ref,r_ref,azimuth_ima);% get the polar position of the reference line 1690 dist_source = interp1(theta_ref,r_ref,DataPol.theta);% get the polar position of the reference line 1691 dist_source_pixel=floor(size(DataPol.A,2)*(dist_source-DataPol.radius(1))/(DataPol.radius(end)-DataPol.radius(1)))+1; 1691 1692 line_nan= isnan(dist_source); 1692 1693 dist_source_pixel(line_nan)=1; … … 1710 1711 %% get the image A*r 1711 1712 [npy,npx]=size(Anorm); 1712 AX=DataPol. Coord_x;1713 AY=DataPol. Coord_y;1714 dX=(AX(2)-AX(1))/(npx-1);1715 dY=(AY(1)-AY(2))/(npy-1);%mesh of new pixels1716 [R,Theta]=meshgrid(linspace(AX(1),AX( 2),npx),linspace(AY(1),AY(2),npy));1713 AX=DataPol.radius; 1714 AY=DataPol.theta; 1715 % dX=(AX(2)-AX(1))/(npx-1); 1716 % dY=(AY(1)-AY(2))/(npy-1);%mesh of new pixels 1717 [R,Theta]=meshgrid(linspace(AX(1),AX(end),npx),linspace(AY(1),AY(end),npy));%matrix of radius and angles with the same size as DataPol 1717 1718 A=R.*Anorm; 1718 1719 A=(A<=0).*ones(npy,npx)+(A>0).*A; %replaces zeros by ones … … 1734 1735 gamma_coeff=NaN(1,npy); 1735 1736 fitlength=NaN(1,npy); 1737 %[ThetaMask,RMask] = cart2pol(MaskData.Coord(:,1)-x0,MaskData.Coord(:,2)-y0); 1738 %ThetaMask=ThetaMask*180/pi 1736 1739 for iY=1:npy% loop on the y index of the image in polar coordinate 1737 1740 ALine=A(iY,:);%profile of image luminosity log (vs radial index) … … 1752 1755 p = polyfit(RLine,ALine,1); 1753 1756 gamma_coeff(iY)=-p(1); 1754 fitlength(iY)=numel(find(check_good)); 1755 end 1757 fitlength(iY)=numel(find(check_good)); 1758 end 1759 1760 %% plot the decay coef versus theta 1761 figure(13) 1762 plot(Theta(:,1),100*gamma_coeff) 1763 xlabel('angle(degree)') 1764 ylabel('decay coeff(m-1)') 1765 1756 1766 1757 1767 %% show and store the rescaled image … … 1760 1770 view_field(DataPol); 1761 1771 imwrite(DataPol.A,NewImageName,'BitDepth',16) 1762 figure(13) 1763 plot(Theta(:,1),100*gamma_coeff) 1764 xlabel('angle(degree)') 1765 ylabel('decay coeff(m-1)') 1772 1766 1773 1767 1774 %% keep the average of gamma_coeff
Note: See TracChangeset
for help on using the changeset viewer.