emgucv - Visual Studio C# Attempted to read or write protected memory. This is often an indication that other memory is corrupt -


i creating attendance system using 4 cameras facial recognition. using emgu cv 3.0 in c#. now, in attendance form, consist of 4 imagebox, application stops , goes main form , shows error button reference attendance form. error was:

attempted read or write protected memory. indication other memory corrupt.

here code error occured:

    private void btn_attendance_click(object sender, eventargs e)     {         attendance attendance = new attendance();         attendance.showdialog();     } 

here code attendance form without recognition part:

public partial class attendance : form {     private capture cam1, cam2, cam3, cam4;     private cascadeclassifier _cascadeclassifier;     private recognizerengine _recognizerengine;     private string _trainerdatapath = "\\traineddata_v2";     private readonly string dbpath = "server=localhost;database=faculty_attendance_system;uid=root;pwd=root;";     mysqlconnection conn;      public attendance()     {        initializecomponent();         conn = new mysqlconnection("server=localhost;database=faculty_attendance_system;uid=root;pwd=root;");     }      private void btn_home_click(object sender, eventargs e)     {         this.close();     }      private void attendance_load(object sender, eventargs e)     {         time_now.start();         lbl_date.text = datetime.now.tostring("");         _recognizerengine = new recognizerengine(dbpath, _trainerdatapath);          _cascadeclassifier = new cascadeclassifier(application.startuppath + "/haarcascade_frontalface_default.xml");         cam1 = new capture(0);         cam2 = new capture(1);         cam3 = new capture(3);         cam4 = new capture(4);          application.idle += new eventhandler(processframe);     }      private void processframe(object sender, eventargs args)     {         image<bgr, byte> nextframe_cam1 = cam1.queryframe().toimage<bgr, byte>();         image<bgr, byte> nextframe_cam2 = cam2.queryframe().toimage<bgr, byte>();         image<bgr, byte> nextframe_cam3 = cam3.queryframe().toimage<bgr, byte>();         image<bgr, byte> nextframe_cam4 = cam4.queryframe().toimage<bgr, byte>();          using (nextframe_cam1)         {            if (nextframe_cam1 != null)             {                 image<gray, byte> grayframe = nextframe_cam1.convert<gray, byte>();                 var faces = _cascadeclassifier.detectmultiscale(grayframe, 1.5, 10, size.empty, size.empty);                 foreach (var face in faces)                 {                     nextframe_cam1.draw(face, new bgr(color.green), 3);                     var predicteduserid = _recognizerengine.recognizeuser(new image<gray, byte>(nextframe_cam1.bitmap));                 }                 imagebox1.image = nextframe_cam1;             }         }          using (nextframe_cam2)         {            if (nextframe_cam2!= null)             {                 image<gray, byte> grayframe = nextframe_cam2.convert<gray, byte>();                 var faces = _cascadeclassifier.detectmultiscale(grayframe, 1.5, 10, size.empty, size.empty);                 foreach (var face in faces)                 {                     nextframe_cam2.draw(face, new bgr(color.green), 3);                     var predicteduserid = _recognizerengine.recognizeuser(new image<gray, byte>(nextframe_cam2.bitmap));                 }                 imagebox2.image = nextframe_cam2;             }         }           using (nextframe_cam3)         {            if (nextframe_cam3!= null)             {                 image<gray, byte> grayframe = nextframe_cam3.convert<gray, byte>();                 var faces = _cascadeclassifier.detectmultiscale(grayframe, 1.5, 10, size.empty, size.empty);                 foreach (var face in faces)                 {                     nextframe_cam3.draw(face, new bgr(color.green), 3);                     var predicteduserid = _recognizerengine.recognizeuser(new image<gray, byte>(nextframe_cam3.bitmap));                 }                 imagebox3.image = nextframe_cam3;             }         }          using (nextframe_cam4)         {            if (nextframe_cam4!= null)             {                 image<gray, byte> grayframe = nextframe_cam4.convert<gray, byte>();                 var faces = _cascadeclassifier.detectmultiscale(grayframe, 1.5, 10, size.empty, size.empty);                 foreach (var face in faces)                 {                     nextframe_cam4.draw(face, new bgr(color.green), 3);                     var predicteduserid = _recognizerengine.recognizeuser(new image<gray, byte>(nextframe_cam4.bitmap));                 }                 imagebox4.image = nextframe_cam4;             }         }     } } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -