#include
#include
#include
#include
#include
#include
#include
using namespace cv;
using namespace std;
int c;
int main(int argc, char* argv[])
{
ofstream fout("output.txt");
Mat image = imread("toilet.jpg", CV_LOAD_IMAGE_GRAYSCALE);
Mat B = image;
if (image.empty()){
fout << "Image open fail" << endl;
exit(1);
}
for (int i = 0; i < 320; ++i){
for (int j = 0; j < 240; ++j){
//3)
if ((int)image.at(i, j) > 120)
{c=c+1;}
fout << setw(3) << " " << (int)image.at(i, j);
}
fout << endl;
}
if (c>3000)
printf("bright pixel : %d \n AAA", c);
else
printf("bright pixel : %d \n BBB", c);
//4)
imshow("ML", B);
//5)
waitKey(0);
image.release(); // isn't it releasing memory?
B.release(); //
return 0;
}
please give me some bright answers it's killing me :(
because it worked right before a day
The error is like figure under.
The error says
Unhandled exception at 0x75915b68 (KernelBase.dll) in opencvtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x0024f558..

↧