code: public BufferedImage getImage() {
  
  		int i = 0;
  		while (image.get() == null) {
  
  			// Just in case if another thread starts calling this method before
  			// updater has been properly started. This will loop while image is
  			// not available.
  
  			try {
  				Thread.sleep(100);
  			} catch (InterruptedException e) {
  				throw new RuntimeException(e);
  			}
  
  			// Return null if more than 10 seconds passed (timeout).
  
  			if (i++ > 100) {
  				LOG.error("Image has not been found for more than 10 seconds");
  				return null;
  			}
  		}
  
  		imageNew = false;
  
  		return image.get();
  	}
docs: Return currently available image. This method will return immediately while it was been
  called after camera has been open. In case when there are parallel threads running and there
  is a possibility to call this method in the opening time, or before camera has been open at
  all, this method will block until webcam return first image. Maximum blocking time will be 10
  seconds, after this time method will return null.
  
  @return Image stored in cache