I would like to analyse the colour of a picture. Is it possible to use the OpenCV library with F# (the only language I am familiar with). If yes, do you know where I can find a tutorial/book on this subject (OpenCV 2 Computer Vision seems great but is written for C++ users).
OpenCV is a popular Computer Vision library to develop applications built using C++ and C. It has several uses like Object Detection and Video Processing. Computer Vision overlaps with fields like Image Processing, Photogrammetry, and Pattern Recognition. A popular wrapper Emgu CV is used to run OpenCV using C#.
Programming language OpenCV is written in C++ and its primary interface is in C++, but it still retains a less comprehensive though extensive older C interface. All of the new developments and algorithms appear in the C++ interface.
If you want to make use of OpenCV, C/C++ is best, but you can also use the Python or Java API as well.
This is definitely possible using F# with one of .NET wrappers over OpenCV. For example, below is the "Hello World" snippet that comes with EmguCV translated from C# to F# that works perfectly:
open Emgu.CV
open Emgu.CV.CvEnum
open Emgu.CV.Structure
[<EntryPoint>]
let main(_) =
let win1 = "Test Window"
CvInvoke.cvNamedWindow(win1) |> ignore
use img = new Image<Bgr, byte>(400, 200, Bgr(255.,0.,0.))
let f = ref (MCvFont(FONT.CV_FONT_HERSHEY_COMPLEX, 1., 1.))
img.Draw("Hello, World", f, System.Drawing.Point(10,80), Bgr(0.,255.,0.))
CvInvoke.cvShowImage(win1, img.Ptr)
CvInvoke.cvWaitKey(0) |> ignore
CvInvoke.cvDestroyWindow(win1)
0
EmguCV web site and installation provide some C# tutorials that may give you initial traction. Your mileage may vary, depending on your F# interop skills among other factors.
Emgu CV is the most popular option with Emgu CV Essentials book. Two other .NET OpenCV wrapper projects:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With