Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory

StackOverflow https://stackoverflow.com/questions/19341382

  •  30-06-2022
  •  | 
  •  

Pregunta

Need Help.

I am doing work on facial emotion recognition in VS2010 using OPENCV and FANN Library. It Build successfully but running it give following error:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at fann_run(fann* , Single* )

at main() in c:\down\uf-lightbot-read-only\src\emo_test.cpp:line 24

at mainCRTStartup()

Code is as follows:

#include <iostream>
#include "fann.h"

using namespace std;

int main()
{
  fann_type *calc_out;
  fann_type input[10];

  struct fann *ann = fann_create_from_file("emotions.net");

  input[0] = 0.87;
  input[1] = 1.20;
  input[2] = 1.03;
  input[3] = 1.45;
  input[4] = 0.96;
  input[5] = 1.00;
  input[6] = 0.98;
  input[7] = 1.486;
  input[8] = 1.042;
  input[9] = 1.016;

  calc_out = fann_run(ann, input);
  cout<<calc_out[0]<<" "<<calc_out[1]<<" "<<calc_out[2]<<" "<<calc_out[3]<<endl;
  fann_destroy(ann);

  return 0;
}

Can any body help me what is the problem ?

Waiting for guidance. . .

Thanks.

¿Fue útil?

Solución

Problem solved. Emotion.net contain doesn't contain some of required variables.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top