2

I need to convert the opencv (c /c++) program into a dll file. I want to use that dll in c# windows form Application.

I tried some methods which is given given by some sites but while adding the references in window forms applications I got an error.

I don't know where made a mistake.

A reference to “D:\WindowsFormApplication4\windowsForrmsApllications4\bin\debug\testdll.dll”
Could not be added. Please make sure that the file is accessible and that it is a valid assembly or COM Component

Here with I have attached my sample code. Please help me.

Void  main(const char*filename)
{
if  (filename ==0)
    {
        printf("The image not loaded\n");
        return -1;
    }
    IplImage* input_im = 0; 
    input_im = cvLoadImage(filename);
    cvNamedWindow("InputImage",CV_WINDOW_AUTOSIZE);
    cvShowImage("InputImage",input_im);
    cvWaitKey(0);
    cvDestroyWindow("InputImage");
    cvReleaseImage(&input_im);

}
0

1 Answer 1

2

this helps? http://www.emgu.com/wiki/index.php/Main_Page

Emgu CV is a cross platform .Net wrapper to the Intel OpenCV image processing library. Allowing OpenCV functions to be called from .NET compatible languages such as C#, VB, VC++, IronPython etc.

Since your program is not that big, you can rewrite it entierly in C#.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks For your reply.its fine for simple code,since my code was some what complected.i need to create the dll from opencv code and will pass the string value to that.The main thing is i dnot have a time to rewrite again.please give some other solution to solve this problem..
first, it is C or C++ code we are talking about. OpenCV is just a library (used by your C/C++ code maybe). Second, you can try compile your .dll with COM Interop enabled. "Configuration Properties -> Build page of your project properties. Look for "Register for COM Interop"." If you can't compile with COM Interop (if its a regular dll with exported functions) try this msdn.microsoft.com/en-us/library/aa287781%28vs.71%29.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.