Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling OpenCV from a web service
    primarykey
    data
    text
    <p>I'm trying to call OpenCV face detection methods from inside a web service, but I'm getting various errors. Not sure if it is possible to do that or if anyone have tried it before. Here's what I did:</p> <p>1- Compile a modified sample OpenCV code at <a href="http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html" rel="nofollow">http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html</a> into a C++ DLL. the modified code is included below</p> <pre><code>String face_cascade_name = "haarcascade_frontalface_alt2.xml"; CascadeClassifier face_cascade; __declspec(dllexport) int __stdcall DetectFaceFromLumaBuffer (char *GrayBuf, int Rows, int Cols) { if (face_cascade.empty()) { if (!face_cascade.load(face_cascade_name)) { return (-1); } } Mat LumaFrame (Rows, Cols, CV_8UC1, GrayBuf, Mat::AUTO_STEP); int Idx = 0; equalizeHist(LumaFrame, LumaFrame); /* Equalize the image histogram */ std::vector&lt;Rect&gt; DetFaces; /* Array of detected rectangles */ face_cascade.detectMultiScale (LumaFrame, DetFaces, 1.1, 3, 0|CV_HAAR_SCALE_IMAGE|CV_HAAR_FIND_BIGGEST_OBJECT, Size(10, 10), Size(LumaFrame.cols, LumaFrame.rows) ); return (DetFaces.size()); } </code></pre> <p>2- Call the DLL's DetectFaceFromLumaBuffer() from .NET C# application using platform invoke.This works fine.</p> <p>3- Call the same function from web service also using platform invoke. The local IIS crashes: IIS Express Worker Process has stopped working.</p> <p>4- Comment out the line "equalizeHist(LumaFrame, LumaFrame);", the call generates an exception "SEHException was unhandled by user code"</p> <p>Any ideas? I'm using VS 2012 express and OpenCV 247</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload