Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using opencvsharp 3.1.0 with visual studio 2015 for a project detecting moving objects. I am using BackgroundsubtractorMOG2 for creating foreground mask.I can successfully run the program with default values but throws access violation exception if I try to set or get properties of BackgroundsubtractorMOG2

What I have tried:

C#
VideoCapturecap = new VideoCapture();
cap.Open(0);
BackgroundSubtractorMOG2 pMOG =BackgroundSubtractorMOG2.Create();
pMOG.shadowThreshold=0.6; // Exception thrown here
while(true)
{
    Mat readframe = new Mat();
    cap.Read(readframe);

    if(!readframe.Empty())
    {

            frame = readframe.Clone();
            frameresult = fc.violationcheck(frame, pMOG);

        }
        else
        {
            frameresult = readframegray;
        }
      }
Posted
Updated 25-Oct-16 21:45pm
v2

1 solution

See OpenCV: cv::BackgroundSubtractorMOG2 Class Reference[^]; you most likely need to call setShadowThreshold.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900