# Path: utils/imgproc.py
# def imread_rgb(dset, path):
# def imread_oflow(dset, *paths):
# def imread_depth(dset, path):
# def inpaint(img, threshold=1):
# def resize(video, size, interpolation):
# def proc_oflow(images):


import os
import cv2
import numpy as np
import utils
from utils import imgproc
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

"""TODO: One-sentence doc string."""



def visualize_rgb(images):
  """Visualize RGB modality."""
  images = utils.to_numpy(images)

  mean = np.array([0.485, 0.456, 0.406])
  std = np.array([0.229, 0.224, 0.225])
  images = np.moveaxis(images, -3, -1)
  images = images*std+mean
  images = np.clip(images*255, 0, 255)
  images = images[..., ::-1].astype(np.uint8)
  images = images[0, 0]  # subsample

  imgproc.save_avi('/home/luoa/research/rgb.avi', images)


def visualize_oflow(images):
  """Visualize optical flow modality."""
  images = utils.to_numpy(images)

  images = np.moveaxis(images, -3, -1)
  images = images[0, 0]  # subsample


# Path: utils/imgproc.py
# def imread_rgb(dset, path):
# def imread_oflow(dset, *paths):
# def imread_depth(dset, path):
# def inpaint(img, threshold=1):
# def resize(video, size, interpolation):
# def proc_oflow(images):


# Path: utils/visualize.py
import os
import cv2
import numpy as np
import utils
from utils import imgproc

# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

"""TODO: One-sentence doc string."""



def visualize_rgb(images):
  """Visualize RGB modality."""
  images = utils.to_numpy(images)

  mean = np.array([0.485, 0.456, 0.406])
  std = np.array([0.229, 0.224, 0.225])
  images = np.moveaxis(images, -3, -1)
  images = images*std+mean
  images = np.clip(images*255, 0, 255)
  images = images[..., ::-1].astype(np.uint8)
  images = images[0, 0]  # subsample

  imgproc.save_avi('/home/luoa/research/rgb.avi', images)


def visualize_oflow(images):
  """Visualize optical flow modality."""
  images = utils.to_numpy(images)

  images = np.moveaxis(images, -3, -1)
  images = images[0, 0]  # subsample


  images = imgproc.proc_oflow(images)