Home » Source Code » fisheye corrction » Untitled6.m

Untitled6.m ( File view )

  • By zhengzou 2014-05-09
  • View(s):31
  • Download(s):12
  • Point(s): 2
			%  功能:纵向抛物线校正

clc;close all;clear all;

a = 400;
%b = 160;
Hnine = 1;

%load('b_m.mat')
%[XX YY] = size(b_m);
%data = imread('C:\CCStudio_v3.3\MyProjects\1\3.8.6 LaplacianSharp\bin\20120701\090-2.bmp');
data = imread('C:\Documents and Settings\Administrator\桌面\a\060.bmp');
[M N ] = size(data);


data(288,:) = 255;
data(:,360) = 255;
data(496,:) = 255;
data(287:289,359:261) = 255;
 figure;imshow(data);

test1 = 0;
test2 = 0;
test3 = 0;
test4 = 0;
rec1 = 0;
rec2 = 0;
data_then = zeros(M,N);
datatest = zeros(M,N);

ftest = zeros(M,N);

ftest = data;

x = 0;
y = 0;
%figure;

for ie = 1%1:150
    for y = -288:288 
       
       
%        b = b_m(ie,1);
%        m = b_m(ie,2)  ;


         b =-192;
         m = 409;
        a = -b/m.^2;
        offset = 300;
        fangcheng = @(yy) (a*((y+offset).^2 + b/a));
        
        
%         bb = -2;
%         aa = 368;
%         
%         
%         offset = 300;
%         fangcheng = @(yy) (bb*(1-(yy+offset).*(yy+offset)/aa/aa).^0.5);

%         k = -98/100;
%         b = 127;
%         offset = 0;
%         fangcheng = @(yy) (k*(y+offset) + b);

        x = fangcheng(y);        

       
      
       ftest(288,:) = 255;

        i_index = M/2 -  y;  % 论文坐标转矩阵坐标
        
        j_index = x + N/2 ;
        %i_index = M/2-i_index;
        
      

        
        i_index = uint32(i_index);
        j_index = uint32(j_index);
        if(i_index>M)
           i_index = M;
         %  test1 = test1 + 1;
       elseif(i_index<1)
          i_index = 1;
         %  test2 = test2 + 1;
        end
        
        if(j_index>N)
            j_index = N;
        %   test3 = test3 + 1;
        elseif(j_index<1)
            j_index = 1;
         %  test4 = test4 +1;
       end
            
        
          ftest(i_index,j_index) = 0;
      %  ftest(i,j) = 255;
        
    
        
       % data_then(i,j) = data(i_index,j_index);
    end
end
imshow(uint8(ftest));

%figure;imshow(uint8(datatest),[]);
%figure;imshow(uint8(data_then));









% 
% %% -----------------透镜形变校正------------------------
% A = [
%      13,59,-1,0,0,0,585,2655
%      0,0,0,13,59,-1,338,1534
%      -68,58,-1,0,0,0,7344,-6264
%      0,0,0,68,-58,1,1496,-1276
%      51,124,-1,0,0,0,2601,6324
%      0,0,0,51,124,-1,6324,15376
%      -113,122,-1,0,0,0,12769,-13786
%      0,0,0,113,-122,1,13786,-14884
%      %-30,106,-1,0,0,0,900,-3180,30
%    
%      ];
% B = [45 26 -108 -22 51 -124 -113 -122 ]';
% 
% value 
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 2

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
060-1.fig270.39 kB01-08-12|10:26
060.bmp406.05 kB18-07-12|09:51
060.fig261.75 kB01-08-12|09:39
080.bmp406.05 kB18-07-12|09:51
090l.bmp406.05 kB18-07-12|09:51
090r.bmp406.05 kB18-07-12|09:51
090r.fig277.17 kB01-08-12|09:34
90.bmp406.05 kB20-07-12|16:14
circ.m533.00 B30-07-12|15:32
correct_image_061g.bmp3.82 MB01-08-12|19:52
fitellipse.m3.13 kB28-07-12|22:38
markpoint.m621.00 B01-08-12|09:57
rec.asv3.29 kB04-08-12|10:40
rec.m3.32 kB04-08-12|11:16
rec2.asv2.02 kB01-08-12|15:54
rec2.m2.02 kB01-08-12|15:55
shiyan5.m3.69 kB27-07-12|15:30
test.asv1.59 kB01-08-12|11:04
test.m1.63 kB01-08-12|16:43
test2.asv3.92 kB01-08-12|10:09
Thumbs.db36.00 kB18-07-12|09:51
trapezial_correction-wrong.m1.50 kB02-08-12|16:59
trapezial_correction.asv3.23 kB02-08-12|17:23
trapezial_correction.m1.66 kB04-08-12|10:09
Untitled.m1.45 kB26-07-12|20:43
Untitled3.m3.98 kB25-07-12|15:44
Untitled5.m3.75 kB23-07-12|08:58
Untitled6.m3.82 kB23-07-12|15:35
截图.jpg125.80 kB29-07-12|20:25
校正0.00 B09-04-13|09:07
...
Sponsored links

Untitled6.m (3.14 MB)

Need 2 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D