Edit

Share via


VNImageRequestHandler.Perform(VNRequest[], NSError) Method

Definition

Asynchronously executes vision recognition for the specified requests.

[Foundation.Export("performRequests:error:")]
public virtual bool Perform (Vision.VNRequest[] requests, out Foundation.NSError error);
abstract member Perform : Vision.VNRequest[] *  -> bool
override this.Perform : Vision.VNRequest[] *  -> bool

Parameters

requests
VNRequest[]

The array of VNRequest objects to look for.

error
NSError

Returns

Attributes

Remarks

Image processing can take several seconds and developers should use a background thread to call this method.

System.Threading.Tasks.Task.Run(() =>
{
	using (var requestHandler = new VNImageRequestHandler(img, new NSDictionary()))
	{
		var findFacesRequest = new VNDetectFaceRectanglesRequest(faceDetectionHandler);
		requestHandler.Perform(new[] { findFacesRequest }, out var error);
		if (error != null)
		{
			HandleError(error);
		}
	}
});

Applies to