Hi all !
I'm trying to use imread to open an image that I write just before, here is my code (sorry, some is in French =) ):
// essais.cpp : définit le point d'entrée pour l'application console.
#include "stdafx.h"
////////////////////////
//**Premiers essais**//
///////////////////////
#include "opencv2/opencv.hpp"
#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
//**Variables
printf("Initialisation variables\n");
CvCapture *avi;
IplImage* im;
Mat immat, imthresh;
Mat imde, imcanny;
char* trackbar_value = "Valeur";
cvNamedWindow("acquisition", CV_WINDOW_AUTOSIZE );
namedWindow("binaire", CV_WINDOW_AUTOSIZE );
namedWindow("dne", CV_WINDOW_AUTOSIZE );
namedWindow("cont", CV_WINDOW_AUTOSIZE );
//**Ouverture de la video
printf("Ouverture video\n");
avi = cvCaptureFromFile("G:\\Anthias\\Output16_boncontraste_bonneglisse_toAVI.avi");
if (!avi)
{
printf("Video non ouverte");
return -1;}
//**Recuperation de la dernière image de la video
while(cvGrabFrame(avi))
im = cvQueryFrame(avi);
cvShowImage("acquisition",im);
cvSaveImage("image.jpg",im);
//**Traitement de l'image
//**Récupération de l'image en tant que Mat
printf("Traitement image\n");
printf("ouverture de l'image...");
immat = imread( "G:/Anthias/OpenCV/Essais/essais/essais/image.jpg", 1 );
if (immat.empty())
{
printf("Image non ouverte\n");
cvWaitKey();
return -2;}
else {printf("Image ouverte\n");}
imshow("binaire",immat);
cvWaitKey();
Everything works, until imread, it crashes and I've an error message :
Unhandled exception at 0x7854fdf1 (msvcr90d.dll) in essais.exe: 0xC0000005: Access
violation reading location 0xCCCCCCCC.
I've seen a question where someone had the same error, but his solution is not mine,
The problem was in environmental variable path, there was for version vs2008 and next for 2012.
I'm using opencv 2.4.1 with Visual Studio 2008, and I've nothing concerning the 2012 version in my path so... IDK xD
I suppose there is something wrong in my environment or whatever, but I can't figure out what it is, and I'm searching for sooo long now ... Please help me ! =) xD
If you need some more infos, just tell me and I'll edit ;)
Thanks all =)