www.pudn.com > DIBR.zip > find_shiftMC3.m, change:2010-05-09,size:1669b


function h = find_shiftMC3(depth,Ny)	 
 
% This function will convert the depth pixel value in the depth map to the 
% particular pixel shift. Inputs to the system are depth, which is the 
% pixel value of the depth map, and Ny is the screen width in pixels. 
 
% This program uses the  formula in MPEG-C, part 3  
% Please refer to MPEG Doc. N8038, Informative Recomendations for more 
% information in this regard.  
% 
%  
 
	nkfar=128; 
	nknear=128; 
	 
    kfar=0; 
    knear=0; 
	 
    h=0; 
	N=256; % Number of depth planes 
	xb=6; %eye separation 6cm 
     
    % This is a display dependant parameter and the maximum shift depends 
    % on this value. However, the maximum disparity should not exceed 
    % particular threshold, defined by physiology of human vision.  
    % 
    % Ny, we assume standard definition display to reduce the parallax 
	Npix = 720;  
     
	D=0; 
 
	h1=0; 
	A=0; 
	h2=0; 
 
	D = 300; %Viewing Distance usually 300 cm  
 
	%According to N8038 
    knear = nknear/64; 
	kfar = nkfar/16; 
 
    % Assumption 1: For visual purposes  
    % This can be let as it is. However, then we are not able to have a 
    % clear understanding of how the rendered views look like.  
    % knear = 0 means everything is displayed behind the screen 
    % which is practically not the case.  
    % 
    % Interested user can remove this part to see what happens. 
    knear = 0; 
     
	A= depth*(knear + kfar)/(N-1); 
 
	h1= -xb*Npix*( A - kfar )/D; 
 
	h2= rem (h1/2,1); 
 
	if (h2>=0.5) 
		h = ceil(h1/2); 
	else 
		h = floor(h1/2); 
    end 
 
	if (h<0) 
        %It will never come here due to Assumption 1 
		h=0-h;  
    end 
end