Setup OpenCV for Xojo

Hi

My apologies in advance if this is a repetitive topic.

I’ve been trying to recreate a simple app that I made in VB.net using OpenCV in Xojo (free version for now). I’m doing this to evaluate Xojo for myself.

I’ve downloaded the OpenCV folder for Xojo and followed the ‘Getting Started’ instructions. I didn’t find the instructions clear and found the OpenCVX folder mentioned in the instructions by; (i) opening an example project; (ii) select and drag the OpenCVX folder into my project folder. Doing this allowed the Xojo intellisense to recognise the OpenCV methods but the Desktop app throws an error when I attempt to open an image as it encounters an OpenCV method. Here’s code (Button action method) for opening an image into an OpenCV data structure:

Dim f As FolderItem
dim imgStruct as IplImage
dim img as MemoryBlock

f = GetOpenFolderItem(“ImageTypes.All”)

if f <> nil and f.Exists and not f.Directory then
try
img = cvLoadImage (f.NativePath, CV_LOAD_IMAGE_ANYCOLOR OR CV_LOAD_IMAGE_ANYDEPTH)
Catch err as Xojo.core.ErrorException
MessageBox(err.Message)
end try
end if

Here’s the error:

I don’t think it’s caused by a wrong file path - I think it may be that I’ve not included the .dylib file correctly.

Please could you tell me how to include the .dylib? I have tried to read the Xojo doc but its not for noobs

Thank you in advance.