function [IntristicsParam] = camCalibrationFunction(fnames, path,squareSize)
    %Camera calibration 
    numImages = length(fnames);
    files = cell(1, numImages);
    for i = 1:numImages
        files{i} = strcat(path,fnames{i});
    end
    I = imread(files{1});
    [imagePoints, boardSize] = detectCheckerboardPoints(files);
    squareSize = str2double(cell2mat(squareSize)); % in millimeters
    worldPoints = generateCheckerboardPoints(boardSize, squareSize);
    % Calibrate the camera.
   imageSize = [size(I, 1), size(I, 2)];
   %cameraParams = estimateFisheyeParameters(imagePoints,worldPoints,imageSize);
    cameraParams = estimateCameraParameters(imagePoints, worldPoints,'ImageSize', imageSize);
    IntristicsParam = cameraParams.Intrinsics;
%     figure; showReprojectionErrors(cameraParams);
%     title('Reprojection Errors');
end