py360convert
py360convert copied to clipboard
a big bug in c2e
The list of equirectangulars generated by c2e is not right, look the picture:
the right, back and up picture is reversed, use an another tool, we got a right list pictures.
@dlutwuwei Which tool would you recommend?
@Boscop You can use a simple numpy function to fix this, here's what I'm doing:
write_img('front', faces[0]) write_img('right', np.flip(faces[1], 1)) write_img('back', np.flip(faces[2], 1)) write_img('left', faces[3]) write_img('up', np.flip(faces[4], 0)) write_img('down', faces[5])
Cause of the problem
I think the reason for this phenomenon is that the xyzcube function in the utils.py
script has the wrong positive direction of the three surfaces R, B and U when generating each surface of the cube @Boscop @lavalamp3774
Explanation
The XYZ axis in the script is defined as follows: the horizontal right of the plane is the positive direction of the X axis, the vertical up is the positive direction of the Y axis, and the positive direction of the Z axis is pointed out perpendicular to the paper according to the right-hand rule
The grid variable is indexed according to the last dimension, which is small on the left, large on the right, small on the bottom and large on the top, that is, the orientation of the coordinate axis of the F surface is correct,
However, for R and B surfaces, the orientation of the coordinate axis should be larger on the left and smaller on the right (the vertical direction remains the same), and for U surfaces, the orientation of the coordinate axis should be larger on the bottom and smaller on the top (the horizontal direction remains the same)
This will cause the final result R, B to flip left and right, and U to flip up and down.
Fix it
The method to correct this error is very simple. Just flip the coordinate axis correctly in the three directions of R, B and U: For example, for R surface (similar to B), it can be changed as follows in this position:
grid_r = np.flip(grid, axis=1)
out[:, 1 * face_w:2 * face_w, [2, 1]] = grid_r
For U surface, changing in this position:
grid_u = np.flip(grid, axis=0)
out[:, 4 * face_w:5 * face_w, [0, 2]] = grid_u