예제 #1
0
    def testTwiceSaturation(self):
        x_shape = [2, 2, 3]
        x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1]
        x_np = np.array(x_data, dtype=np.uint8).reshape(x_shape)

        saturation_factor = 2.0
        y_data = [0, 5, 13, 0, 106, 226, 30, 0, 234, 89, 255, 0]
        y_np = np.array(y_data, dtype=np.uint8).reshape(x_shape)

        with self.test_session():
            x = constant_op.constant(x_np, shape=x_shape)
            y = image_ops.adjust_saturation(x, saturation_factor)
            y_tf = y.eval()
            self.assertAllEqual(y_tf, y_np)
예제 #2
0
  def testTwiceSaturation(self):
    x_shape = [2, 2, 3]
    x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1]
    x_np = np.array(x_data, dtype=np.uint8).reshape(x_shape)

    saturation_factor = 2.0
    y_data = [0, 5, 13, 0, 106, 226, 30, 0, 234, 89, 255, 0]
    y_np = np.array(y_data, dtype=np.uint8).reshape(x_shape)

    with self.test_session():
      x = constant_op.constant(x_np, shape=x_shape)
      y = image_ops.adjust_saturation(x, saturation_factor)
      y_tf = y.eval()
      self.assertAllEqual(y_tf, y_np)
예제 #3
0
    def testHalfSaturation(self):
        x_shape = [2, 2, 3]
        x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1]
        x_np = np.array(x_data, dtype=np.uint8).reshape(x_shape)

        saturation_factor = 0.5
        y_data = [6, 9, 13, 140, 180, 226, 135, 121, 234, 172, 255, 128]
        y_np = np.array(y_data, dtype=np.uint8).reshape(x_shape)

        with self.test_session():
            x = constant_op.constant(x_np, shape=x_shape)
            y = image_ops.adjust_saturation(x, saturation_factor)
            y_tf = y.eval()
            self.assertAllEqual(y_tf, y_np)
예제 #4
0
  def testHalfSaturation(self):
    x_shape = [2, 2, 3]
    x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1]
    x_np = np.array(x_data, dtype=np.uint8).reshape(x_shape)

    saturation_factor = 0.5
    y_data = [6, 9, 13, 140, 180, 226, 135, 121, 234, 172, 255, 128]
    y_np = np.array(y_data, dtype=np.uint8).reshape(x_shape)

    with self.test_session():
      x = constant_op.constant(x_np, shape=x_shape)
      y = image_ops.adjust_saturation(x, saturation_factor)
      y_tf = y.eval()
      self.assertAllEqual(y_tf, y_np)