In this tutorial, we will look at how to work with the ImageProcessing library using code rather than console commands.
|
NOTE: The library uses .NET 7.0. Make sure your application complies with this requirement.
Load your image using the loadAsImage function from the MyImage module.
|
For CPU and GPU the list of transforms is identical, decide what you want to process your image on and select the appropriate function to process from the CpuProcessing module or the GpuProcessing module respectively.
Apply the fisheye filter to the uploaded image.
|
Don't forget to save the processed image using the saveImage function from the MyImage module!
|
In the case of GPU processing, you have to go through a few extra steps to achieve your goal:
Prepare OpenCl context and queue(from Brahma.FSharp module):
|
Compile the kernel to apply the filter using the fishEyeKernel function from the GpuKernels module:
|
Process the image using the fishEye function from the GpuProcessing module:
|
Don't forget to save the new image:
|
For more info about GPU processing please check Brahma