# Setup OpenCV for Xojo

**URL:** <https://forum.xojo.com/t/setup-opencv-for-xojo/59712>\
**Category:** Extras\
**Created:** [December 11, 2020, 4:59pm UTC](https://forum.xojo.com/t/setup-opencv-for-xojo/59712 "2020-12-11T16:59:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Edwards](https://forum.xojo.com/user_avatar/forum.xojo.com/marc_edwards/32/2757_2.png) [@Marc\_Edwards](https://forum.xojo.com/u/Marc_Edwards)\
**Post date:** [December 11, 2020, 4:59pm UTC](https://forum.xojo.com/t/setup-opencv-for-xojo/59712/1 "2020-12-11T16:59:36Z")

</div>

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](http://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](https://github.com/ldci/OpenCV-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:

 ![error1](https://forum.xojo.com/uploads/default/original/2X/8/87acb63abe8b59765632d39db73243630df70ac3.png)

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.
