pmoulon / CMVS-PMVS

This software (CMVS) takes the output of a structure-from-motion (SfM) software as input, then decomposes the input images into a set of image clusters of managable size. An MVS software can be used to process each cluster independently and in parallel, where the union of reconstructions from all the clusters should not miss any details that can be otherwise obtained from the whole image set. CMVS should be used in conjunction with an SfM software Bundler and an MVS software PMVS2 (PMVS version 2).
http://opensourcephotogrammetry.blogspot.com/
939 stars 464 forks source link

126 image cap #30

Open tonisvain opened 6 years ago

tonisvain commented 6 years ago

Hi.

I don't know if this is the correct place for issue but it came up using this library. I have searched for fixes but have not found any. Found only one good topic but it seems this has already been fixed. link: libjpeg causes weird crash

I have looked over the files. All have permissions and are there. If there are less than 126 images, then it runs fine but maxes out at 126 for no apparent reason.

MacBook-Air:~ user$ cmvs /Users/user/Desktop/scan/dense.nvm.cmvs/00/ 100 4
Reading bundle...513 cameras -- 274217 points in bundle file
***********
513 cameras -- 274217 points
Reading images: ******************************************************************************************************************************
Couldn't read image /Users/user/Desktop/scan/dense.nvm.cmvs/00/visualize/00000126.jpg
Unsupported iamge format found. Stop allocation: /Users/user/Desktop/scan/dense.nvm.cmvs/00/visualize/00000126.jpg
*Unrecognizable txt format

i tried to find what might cause the exception but could not really get that far. also the camera file raised an exception. first thing i checked was if the .txt files have the correct data in them and they all do. so i have no idea why i got that error.

error: Couldn't read image /Users/user/Desktop/scan/dense.nvm.cmvs/00/visualize/00000126.jpg program/base/image/camera.cc line 38:

void Ccamera::init(const std::string cname, const int maxLevel) {
  ...
  string header;
  ifstr >> header;
  if (header == "CONTOUR")
    m_txtType = 0;
  else if (header == "CONTOUR2")
    m_txtType = 2;
  else if (header == "CONTOUR3")
    m_txtType = 3;
  else {
    cerr << "Unrecognizable txt format" << endl;
    exit (1);
  }
  ...
  updateCamera();
}

This is where the actual error is from i think. and looks like it traces back to Cimg.h as it did in the other case that i linked to. but where exactly i have no idea.

error: Unsupported iamge format found. Stop allocation: /Users/user/Desktop/scan/dense.nvm.cmvs/00/visualize/00000126.jpg program/base/image/image.cc line 124:

if (readAnyImage(m_name, m_images[0], m_widths[0], m_heights[0], fast) == 0) {
    cerr << "Unsupported iamge format found. Stop allocation: "
     << m_name << endl;
    return;
  }

error: Unrecognizable txt format program/base/image/image.cc line 532:

int Cimage::readAnyImage(const std::string file, std::vector<unsigned char>& image, int& width, int& height, const int fast)
{
  // Use CImg for image loading
  cimg_library::CImg<unsigned char> cimage;
  try
  {
     ...
  }
  catch(cimg_library::CImgException &e)
  {
    std::cerr << "Couldn't read image " << file.c_str() << std::endl;
    return 0;
  }
  return 1;
}

for reference, some of the library versions:

any type of fix will be welcomed!

pmoulon commented 6 years ago

The strange thing is that the progress bar is not at zero. So it seems that some image are correctly loaded. Seems like the first 125 images are correctly loaded.

I would advice this:

  1. Check that the image (126) is existing on your disk
  2. Check if the ram is not used (perhaps the image is not loaded due to a memory overflow)

You can try to use various value for downsampling the image to see if it's a memory issue or not

tonisvain commented 6 years ago
  1. I have checked, all the files are there and are correct.
  2. looking at the activity monitor, it does not show a substantial increase in memory usage, but that might not give a full picture. also tied to run other applications that use a lot of RAM at the same time so 7GB was in use and it still failed at the same point.

How much RAM does it typically need? i have 8GB of ram and there should be some extra using VM. the pictures are actually quite small to begin with. 1086X724 and 300 - 500 KB per pic How do i select the downsampling?

pmoulon commented 6 years ago

Subsampling can be changed by changing the variable level in the pmvs file: https://www.di.ens.fr/pmvs/documentation.html

The other possibility is that your image folder contains many .. You can try to rename your folder hierarchy to do not contains any ..

pmoulon commented 6 years ago

I was able to reproduce the issue. For me it happens in image 510 out of a dataset of 800. I would advise you to look to https://github.com/alexlocher/hpmvs