Error loading image 7656x6619 [closed]
im trying to load 2 images of 150MB and i cant load it someone can helme please?
this is my code, i don´t have errors
Mat imageRed = imread("images/OrtoImagenTest/band(3).tif", CV_LOAD_IMAGE_GRAYSCALE);
Mat imageNir = imread("images/OrtoImagenTest/band(4).tif", CV_LOAD_IMAGE_GRAYSCALE);
int rows = imageRed.rows;
int cols = imageRed.cols;
cout <<"rows " <<rows << endl;
cout << "cols " << cols << endl;
if (!imageRed.data || !imageNir.data)
{
cout << "error al leer las imagenes";
return -1;
}
Well maybe try resizing img and check if your problem is related to the size or if there is somthing else wrong during reading it in. Also check for error messages /logs.
if i read the image with CV_LOAD_IMAGE_ANYDEPTH i can read the image but the values of each pixel are the same and negative thisa is the code
Mat imageRed = imread(ubicacion+"band(3).tif", CV_LOAD_IMAGE_ANYDEPTH); Mat imageNir = imread(ubicacion+"band(4).tif", CV_LOAD_IMAGE_ANYDEPTH); if (!imageRed.data /|| !imageNir.data/) { cout << "error al leer las imagenes"; return -1; } int rows = imageRed.rows; int cols = imageRed.cols; cout <<"rows " <<rows <<="" endl;="" cout="" <<="" "cols="" "="" <<="" cols="" <<="" endl;="" int="" seccion="rows/3;" int="" cont="0;" cout="" <<="" "seccion="" :"="" <<="" seccion="" <<="" endl;="" float="" sumandvi="0;" to="" chec="" every="" pixel="" inthe="" image="" for="" (int="" row="0;" row="" <="" rows;="" row++)="" {="" for(int="" col="0;" col="" <="" cols;="" col++)="" {="" vec4i="" pixelred="imageRed.at<Vec4i">(row,col ); cout <<"pixel red";
i got this values for each pixel [-971227136, -971227136, -971227136, -971227136]
Ok well i know that pixels must be in range between 0..255 For a color picture you have three of them (each for r,g,b channel) You are reading it in as a greyscale image.
Can you do the same like before but read it in as a color image (just imread with path) If you still see strang pixel values - you picture is most likely corrupt or opencv has problems with the picture format(i dont think so - opencv is pretty versatile) Try open it in another application if possible and check it is not corrupt.
the picture format is .tiff, i can open the image with windows image editors, this are the images: imageNir :https://mega.nz/#!fsoWXCTY!ntknlYIUIxmDFklyCUlWggcunRTSjNnBu6rRXZ63PdA imageRed: https://mega.nz/#!2kx0iCjK!JQn5TQp2yu...
Hmm dude - i just downloaded your image and immediality got a None object(python) back. Opencv just cannot read in your picture this way.
I did
And its fine now. I guess tiff is a uncompressed and raw format. Well i just give a f* about this. I am just a bit annoyed that you did not include this in problem description.
Nvm its not that big of deal but please include relevant information.Anyway i consider this as solved. If you still have problems somehow(i tested on windows) - just convert image to jpg or sth.
Good luck and hf!