Coder Social home page Coder Social logo

a big bug in c2e about py360convert HOT 3 OPEN

sunset1995 avatar sunset1995 commented on July 21, 2024
a big bug in c2e

from py360convert.

Comments (3)

lavalamp3774 avatar lavalamp3774 commented on July 21, 2024 3

@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])

from py360convert.

zafirshi avatar zafirshi commented on July 21, 2024 3

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

from py360convert.

Boscop avatar Boscop commented on July 21, 2024

@dlutwuwei Which tool would you recommend?

from py360convert.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.