code: public static <T extends ImageBase<T>> T checkDeclare(T input, T output) {
  		if (output == null) {
  			output = (T) input.createNew(input.width, input.height);
  		} else {
  			output.reshape(input.width, input.height);
  		}
  		return output;
  	}
docs: If the output has not been declared a new instance is declared.  If an instance of the output
  is provided its bounds are checked.