function helperMonoSensorWrapper(frame)

persistent monoSensor;

focalLength    = [320, 320];
principalPoint = [640, 480]/2;
imageSize      = [480, 640];
height         = 1.2;    % mounting height in meters from the ground
pitch          = 0;      % pitch of the camera in degrees

if isempty(monoSensor)
    
    % Camera setup
    %-------------
    camIntrinsics = cameraIntrinsics(focalLength, principalPoint, imageSize);
    sensor        = monoCamera(camIntrinsics, height, 'Pitch', pitch);
    
    monoSensor   = helperMonoSensorSim3D(sensor);
    
    % Lane marker detection parameters
    %---------------------------------
    % The percentage extent of the ROI a lane needs to cover. It can remove
    % noisy detections
    monoSensor.LaneXExtentThreshold = 0.4;
    
    monoSensor.LaneSegmentationSensitivity = 0.5; % increased as compared to original demo
    monoSensor.ApproximateLaneMarkerWidth = 0.3;  % width specified in meters; something is wrong in the engine; check!
    monoSensor.LaneStrengthThreshold = 0.2;
    
    monoSensor.MaxNumLaneMarkersToDetect = 2;

    % Vehicle detection parameters
    %-----------------------------
    monoSensor.IsDetectingVehicles = false; % turn off vehicle detection to concentrate on lane markers
    
    % To remove false detections from shadows in this video, we only return
    % vehicle detections with higher scores.
    monoSensor.VehicleDetectionThreshold = 20;
end

sensorOut = processFrame(monoSensor, frame);

closePlayers = false;

displaySensorOutputs(monoSensor, frame, sensorOut, closePlayers);

end
