The post by Grzeli is a good read and starting point to understand how the conversion is done and it will help you a lot if you wanted to implement the conversion method yourself.
However, if you want to just call a function, you I found the following code sample hope it serves you good:
Convert from RGB to YUV