Skip to content

seamlessClone Bug for OpenCV > ver-3.3 #12496

@vikasgupta-github

Description

@vikasgupta-github

OpenCV => 3.3.1

There is a difference in the output of seamlessClone function between OpenCV 3.3 and higher versions. The output was correct for OpenCV <= 3.3

Please find below the code used and the results I'm getting.

Images used:

wood-texture.jpg - wood-texture.jpg

ticket - iloveyouticket.jpg

Code:

  im = cv2.imread("wood-texture.jpg")
  obj= cv2.imread("iloveyouticket.jpg")
  # Create an all white mask
  mask = 255 * np.ones(obj.shape, obj.dtype)

  # The location of the center of the src in the dst
  width, height, channels = im.shape
  center = (int(height/2), int(width/2))

  # Seamlessly clone src into dst using two different methods
  normalClone = cv2.seamlessClone(obj, im, mask, center, cv2.NORMAL_CLONE)
  mixedClone = cv2.seamlessClone(obj, im, mask, center, cv2.MIXED_CLONE)

  cv2.imwrite("opencv-normal-clone-example.jpg", normalClone)
  cv2.imwrite("opencv-mixed-clone-example.jpg", mixedClone)

Results for OpenCV <= 3.3

-- Normal Clone

-- Mixed Clone

Results for OpenCV > 3.3

-- Normal Clone

-- Mixed Clone

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions