You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: f_myundistortImage.m
    path of file: ./repos/PBACalib/matlab/utils
    
    the code of the file until where you have to start completion: function img_undist= myundistortImage(img_in, K, D)
% Corrects an image for lens distortion.

    
function img_undist= myundistortImage(img_in, K, D)
% Corrects an image for lens distortion.
% K为内参矩阵，用来归一化坐标的，给定的d
% D为径向畸变参数，给定的

IntrinsicMatrix = K';
radialDistortion = [D(1),D(2),D(5)];
tangentialDist = [D(3),D(4)];
imageSize = [size(img_in,1),size(img_in,2)];
principalPoint =[K(1,3),K(2,3)];
cam_param = cameraParameters('IntrinsicMatrix',IntrinsicMatrix,'RadialDistortion',radialDistortion,'TangentialDistortion',tangentialDist);
img_undist = undistortImage(img_in,cam_param); 

end