/** * \brief Check that the image sequence is consistent * * Only a if all the images are of the same size we can actually compute * a calibration image. * \param images */ bool consistent(const ImageSequence& images) { // make sure all images in the sequence are of the same size ImageSequence::const_iterator i = images.begin(); for (i++; i != images.end(); i++) { if ((*images.begin())->size() != (*i)->size()) { debug(LOG_DEBUG, DEBUG_LOG, 0, "image size mismatch"); return false; } } // make sure all the images are monochrome images. There is now way // to calibrate color image, for (i = images.begin(); i != images.end(); i++) { if (isColorImage(*i)) { return false; } } return true; }
void ImageMean<T>::setup_pv(const ImageSequence& images) { // the image sequence must be consistent, or we cannot do // anything about it if (!consistent(images)) { throw std::runtime_error("images not consistent"); } // we need access to the pixels, but we want to avoid all the // time consuming dynamic casts, so we create a vector of // PixelValue objects, which already do the dynamic casts // in the constructor ImageSequence::const_iterator i; for (i = images.begin(); i != images.end(); i++) { pvs.push_back(PV(*i)); } }