2018-11-28 23:45:33 -0500 received badge ● Famous Question (source) 2016-09-12 04:24:50 -0500 received badge ● Famous Question (source) 2015-10-22 10:20:09 -0500 received badge ● Notable Question (source) 2015-06-03 23:32:05 -0500 received badge ● Notable Question (source) 2014-10-28 06:34:31 -0500 received badge ● Popular Question (source) 2014-06-09 02:14:52 -0500 received badge ● Popular Question (source) 2013-03-15 05:27:28 -0500 commented answer Result issues with findContours Me again, it works ! I have my lovely message "found 5 fishes" ! so great ! Thank you very much ! ^^ My problem is solved hehe =) 2013-03-15 05:20:59 -0500 commented answer Access Violation with imread done ;) thank you ! =) 2013-03-15 05:20:28 -0500 received badge ● Scholar (source) 2013-03-15 05:19:11 -0500 commented answer Result issues with findContours Hey ! I'm back ! My "imread" problem is now solved, all my code is written in C++ style, and it works =) the debug mode wasn't configured properly. Now if I run my program, I have finally, 10 fishes, instead of 12404. It's still too many but it's much better =) I'll try to have my 5 fishes with your help, and I'll comment to give my results =) thanks ;) 2013-03-15 05:12:24 -0500 commented answer Access Violation with imread finally found that my debug mode wasn't configured properly, I'm so happy that it works now, and I'm sorry for that question which have indeed a quite simple solution xD and thanks a lot for your help =) This topic is now closed I guess =) 2013-03-15 05:09:28 -0500 commented question Access Violation with imread oh my god, finally found how to configure this debug mode, it works now !! =) no such error now, i'm so happy \o/, and I'm sorry because it was quite a simple problem/solution by the way, I just didn't managed to find a complete configuration tuto xD Thanks a lot for your idea and your help. This topic can be closed now I guess =) 2013-03-15 03:51:56 -0500 commented question Access Violation with imread I've re-wrote my code using C++ style only, please see my edit 1 =) Now I have the same error but with VideoCapture :/ ... Plus, In Tools->Options for library files, I had a path for x64 vc9 lib, I changed for x86 vc9 lib, restart, bit still have that error ... so idk 2013-03-14 10:54:40 -0500 asked a question Access Violation with imread 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 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 =) EDIT 1 : // 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 #include using namespace cv; using namespace std; int main(int argc, char** argv) { //**Variables printf("Initialisation variables\n"); VideoCapture avi; Mat im, immat; Mat imde, imcanny, imthresh; 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 = VideoCapture("G:/Anthias/Output16_boncontraste_bonneglisse_toAVI.avi"); if (!avi.isOpened()) { printf("Video non ouverte"); return -1;} I've re-write all my code in C++, and now I've got the same kind of error, but with VideoCapture : Unhandled exception at 0x77c17bec in essais.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC. I think this is why I started to write using C style, and then changed to C++ style because I ... 2013-03-14 10:23:18 -0500 commented answer Result issues with findContours I use CV_32FC1 because I've done ctrl+c -> ctrl+v from a tutorial I guess xD but, I see, I've changed for CV_8UC1, and now I have 12409 fishes, instead of 12404 xD I'll create a new question then. I suppose I've got a problem in my environment, but, I've checked manytimes where there could be something wrong, and I don't find anything of that kind so, I don't know. But thanks ;) 2013-03-14 04:50:47 -0500 commented answer Result issues with findContours I've tried your code (with no other code around and the image for argv, I suppose it's what you did), and I've got an error "Exception non gérée à 0x... (msvcr90.dll) dans essais.exe : 0x... : Violation d'accès lors de la lecture de l'emplacement 0x..." = Reading access violation. And nothing else. A yellow arrow points "if (*file==_T('\0'))" in the "fopen.c" file, and I have a table "Nom = *file / Valeur = 0 / Type = const char". I suppose there's a problem when opening the image but, why ? I remember I wanted to use imread in my code, but it didn't work (same error) so I do this : "immat=cvCreateMat(im->height, im->width, CV_32FC1); Mat immat(im);" which works. Why do I have this problem with imread ?! Thanks 2013-03-14 02:59:36 -0500 commented answer Result issues with findContours Just before "findcontours" I use "threshold" so my image is in black and white (background in white, and the fishes in black, completly), so the eyes or whatever are not "seen". I tried CV_RETR_EXTERNAL instead of CV_RETR_LIST but then I use "drawcontours", and the only contour drawn is in fact the contour of the image, the contour of the fishes are not detected anymore. I'll edit my post to show some images. Plus, I have only one contour, but, the result still says "Found 12404 fishes" haha xD weird... But thank you ;) 2013-03-14 02:47:58 -0500 commented answer Result issues with findContours The image is taken from a video recorded by a monochrome camera, thought it was already in grayscale but apparently not, I don't have this error anymore now, thank you =) but I still have my message "Found 12404 fishes" instead of 5. I'll try what "Guanta" says in his answer ;) 2013-03-13 11:02:57 -0500 commented answer Result issues with findContours Thanks, I edited my post, as you can see, I blur the image just before threshold ;) and the threshold is simple. I've tried to use findcontours directly (so without Canny), but I've got an error about the format of the image if I've understood --' and now, I'm lost xD 2013-03-13 10:58:21 -0500 received badge ● Editor (source) 2013-03-13 09:39:16 -0500 asked a question Result issues with findContours Hi all ! I'm kind of new to opencv, and on top of that, I'm french, so, sorry =) I'm using opencv 2.4.1 with visual studio 2008 and i'm having issues with my detection program. I've an image on which there are fishes that I want to detect. I do all the stuff to have an image on which I can work (threshold, dilate, erode...)and then I use Canny and findContours, this is when it gets weird : There are 5 fishes on the image, but the message tells me there are 12404 fishes oO 12404 corresponds to contours.size() Just before, I draw those "contours", and I can clearly see my 5 fishes with their contour drawn in red. So why do I have those 5 drawn contours, but 12404 fishes ?! I'v spent so many time searching and trying anything else but unsuccessfully. Here is the part of my code corresponding : //**Edges detection Canny (imde,imcanny,75,150,3); imshow("cont",imcanny); cvWaitKey(); //**Contours finding and drawing = way number 1 static vector'<'vector'<'Point'>'> contours; //There ar no '' around < in my code, //it's just for you to see (html code hides what's in '<>') findContours(imcanny,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE); drawContours(immat,contours,-1,CV_RGB(255,0,0),2); //**Récupération et affichage du nombre de poissons détectés char msg[20]; sprintf(msg, "Found %d fishes",contours.size()); printf(msg); //putText(imcanny,msg,cvPoint(2,12),FONT_HERSHEY_SIMPLEX, 0.4, CV_RGB(255,0,0)); imshow("cont",immat); cvWaitKey(); I don't know what I'm doing wrong, I've used exactly what is used in the "coins counting" tutorial so... Thanks a lot for your help Tell me if you need to see another part of my code, or the images maybe, and I'll edit =) Thanks EDIT 1 : Here is what I do to the image just before Canny : //**Lissage de l'image medianBlur(immat,immat,5); imshow("binaire",immat); cvWaitKey(); //**Binarisation de l'image threshold(immat,imthresh,75,255,CV_THRESH_BINARY); imshow("binaire",imthresh); cvWaitKey();* //**Dilatation de l'image int dilatation_size=1; //dilatation max=21 Mat element=getStructuringElement(MORPH_RECT, Size(2*dilatation_size+1,2*dilatation_size+1), Point(dilatation_size,dilatation_size)); dilate(imthresh,imde,element); imshow("dne",imde); cvWaitKey(); //**Erosion de l'image int erosion_size=1; //erosion max=21 Mat elementt=getStructuringElement(MORPH_RECT, Size(2*erosion_size+1,2*erosion_size+1), Point(erosion_size,erosion_size)); erode(imde,imde,elementt); imshow("dne",imde); cvWaitKey(); EDIT 2 Here are some images : The very first one, taken from a video : The one after "cvtcolor" & "medianblur" : The one after "threshold", "dilate" & "erode" : The one after "findcontours" and "drawcontours" (bold black) with CV_RETR_LIST : And the one after "findcontours" and "drawcontours" (bold black) if I use CV_RETR_EXTERNAL instead of CV_RETR_LIST : In both case I've got my lovely message "found 12404 fishes", this value doesn't change whatever I do... Thanks for your help =)