Using OpenCV from F #

I would like to analyze the color of the image. Is it possible to use the OpenCV library with F # (the only language I am familiar with). If so, did you know where I can find a tutorial / book on this topic (OpenCV 2 Computer Vision seems great, but written for C ++ users).

+5
source share
3 answers

This is definitely possible using F # with one of the .NET wrappers on top of OpenCV. For example, below is the “Hello World” snippet that comes with EmguCV , translated from C # to F #, which works just fine:

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 #, . F # .

+8

EmguCV - .NET OpenCV. F #.

+1

Emgu CV is the most popular option with the Emgu CV Essentials book. Two other .NET OpenCV shell projects:

+1
source

All Articles