Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Thin plate spline transform gives solid color for certain inputs

Đang mở
#1,139 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
opencv, python
Lĩnh vực
computer-vision

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện Python được cung cấp với test.png và các phiên bản Python 3.13.5 và OpenCV 4.12.0.88 đã báo cáo. So sánh các phép biến đổi chín điểm và tám điểm, sau đó xác định lỗi nằm ở đâu và xác minh rằng phép biến đổi đồng nhất chín điểm không còn tạo ra hình ảnh một màu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

question

Certain combinations of points for a thin plate spline transformation cause the transformed image to be one solid color. Removing the offending combination of points will cause the image to transform as expected.

Below is code that reads the attached image and applys a transformation which should do nothing to the image. The first transformation erroneously turns the whole image a single color. The second transformation uses one less point and correctly does nothing to the image. Im not sure what makes combinations of points not compatible with each other. The points in the code are outside of the uploaded image, since the points were originally being used on a much larger image. I can't upload that here due to file size restrictions. However behavior on the smaller image is the same. Versions are Python 3.13.5, opencv-contrib-python 4.12.0.88, opencv-python 4.12.0.88, Windows 10.

import cv2
import numpy

# Variable initilization
img = cv2.imread('test.png')
base_points = numpy.array([[ 121, 5213],
                    [6197, 5197],
                    [1627, 3481],
                    [3146, 3477],
                    [4668, 3473],
                    [1616, 1752],
                    [4655, 1744],
                    [6179, 1742],
                    [  87,   29]])

# In this example a tps transformation is done.
# The input and output points are the same so the image shouldn't change.
# The whole image will be the color of the one of the corner pixels.
points = base_points[:]
points = points.reshape((-1,points.shape[0],2)).astype(numpy.int32)
tps = cv2.createThinPlateSplineShapeTransformer()
matches = [cv2.DMatch(i, i, 0) for i in range(points.shape[1])]
tps.estimateTransformation(points, points, matches)
warped1 = tps.warpImage(img)
cv2.imshow('Whole image is one color', warped1)

# This example uses one less point.
# The output is the input image, which is what would be expected.
points = base_points[1:]
points = points.reshape((-1,points.shape[0],2)).astype(numpy.int32)
tps = cv2.createThinPlateSplineShapeTransformer()
matches = [cv2.DMatch(i, i, 0) for i in range(points.shape[1])]
tps.estimateTransformation(points, points, matches)
warped2 = tps.warpImage(img)
cv2.imshow('Image is as expected', warped2)

cv2.waitKey(0)

Correct image: Image

Single color image: Image

Ngôn ngữ chính
Python
Star
5.4k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của opencv/opencv-python

Tất cả issue của opencv/opencv-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.