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: boundaryPR.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/colorStatistics/3rd_party/segmentationBerkeley/lib/matlab
    
    the code of the file until where you have to start completion: function [thresh,cntR,sumR,cntP,sumP] = boundaryPR(pb,segs,nthresh)
% function [thresh,cntR,sumR,cntP,sumP] = boundaryPR(pb,segs,nthresh)
%
% Calcualte precision/recall curve.
% If pb is binary, then a single point is computed.
% The pb image can be smaller than the segmentations.

    
function [thresh,cntR,sumR,cntP,sumP] = boundaryPR(pb,segs,nthresh)
% function [thresh,cntR,sumR,cntP,sumP] = boundaryPR(pb,segs,nthresh)
%
% Calcualte precision/recall curve.
% If pb is binary, then a single point is computed.
% The pb image can be smaller than the segmentations.
%
% INPUT
%	pb		Soft or hard boundary map.
%	segs		Array of segmentations.
%	[nthresh]	Number of points in PR curve.
%
% OUTPUT
%	thresh		Vector of threshold values.
%	cntR,sumR	Ratio gives recall.
%	cntP,sumP	Ratio gives precision.
%
% See also boundaryPRfast.
% 
% David Martin <dmartin@eecs.berkeley.edu>
% January 2003

if nargin<3, nthresh = 100; end