Thin plate spline transform gives solid color for certain inputs
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- opencv, python
调研方向
首先,使用 test.png 以及报告的 Python 3.13.5 和 OpenCV 4.12.0.88 版本运行提供的 Python 复现程序。比较九点变换和八点变换,然后确定故障所在,并验证九点恒等变换不再生成纯色图像。
由索引模型根据 Issue 内容生成。
描述
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:
Single color image:
- 主要语言
- Python
- 星标
- 5.4k
- 派生
- 1k
- 平均合并
- 22 小时 17 分钟
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
opencv/opencv-python 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
opencv/opencv-python#1217 · 3 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
opencv/opencv-python#1165 · 2 条评论 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
opencv/opencv-python#1273 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
opencv/opencv-python#1272 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 70/100
opencv/opencv-python#1268 · 1 条评论 ·
查看 opencv/opencv-python 的全部 Issue
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·