Should I provide references to a function which is used as part of a programming language? I am writing a paper, which in the application used a function from a programming language (in this case, it is OpenCV function canny edge detection).  When is or is not appropriate to explain the algorithm in mathematics/words and when or how should a function be referenced.  

In this case, OpenCV explains the algorithm http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html

Should I just provide a link to this, as I did not modify the algorithm but it is an important part of the implementation decision.

Is there a standard way of deciding to reference the language, function, or original algorithm?
In this case I would opt to cite the paper in which Canny edge detection was introduced. Citing OpenCV as a whole is more appropriate than referring to a specific function, e.g. "we obtained our results using OpenCV [Bradski00]". Since you use OpenCV, you should also cite the related paper.

I would only refer to a specific function in a software package if it does not implement a known algorithm and therefore requires special attention.