Skip to content

Commit 1248c2e

Browse files
2winsJonathan DEKHTIAR
authored andcommitted
Fix a bug transform_matrix_offset_center (#855)
* Fix a bug `transform_matrix_offset_center` - calculation of offset: sign error * Update CHANGELOG.md * Add PR number * minor modification * minor modification
1 parent 0fccb79 commit 1248c2e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ To release a new version, please update the changelog as followed:
8585
### Deprecated
8686

8787
### Fixed
88+
- Correct offset calculation in `tl.prepro.transform_matrix_offset_center` (PR #855)
8889

8990
### Removed
9091

9192
### Security
9293

9394
### Contributors
94-
- @2wins: #850
95+
- @2wins: #850 #855
9596
- @DEKHTIARJonathan: #853
9697

9798
## [1.10.1] - 2018-09-07

tensorlayer/prepro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,8 +1719,8 @@ def transform_matrix_offset_center(matrix, x, y):
17191719
- See ``tl.prepro.rotation``, ``tl.prepro.shear``, ``tl.prepro.zoom``.
17201720
17211721
"""
1722-
o_x = float(x) / 2 + 0.5
1723-
o_y = float(y) / 2 + 0.5
1722+
o_x = (x - 1) / 2.0
1723+
o_y = (y - 1) / 2.0
17241724
offset_matrix = np.array([[1, 0, o_x], [0, 1, o_y], [0, 0, 1]])
17251725
reset_matrix = np.array([[1, 0, -o_x], [0, 1, -o_y], [0, 0, 1]])
17261726
transform_matrix = np.dot(np.dot(offset_matrix, matrix), reset_matrix)

0 commit comments

Comments
 (0)