Giter Club home page Giter Club logo

Comments (3)

kwea123 avatar kwea123 commented on June 26, 2024 5

If you install opencv-python, there is a more concise way, add the following lines after
spericalCoord = self._calcSphericaltoGnomonic(convertedScreenCoord)

sphericalCoord = sphericalCoord.reshape(self.height, self.width, 2).astype(np.float32) % 1
out = cv2.remap(frame, 
                        sphericalCoord[..., 0]*self.frame_width, 
                        sphericalCoord[..., 1]*self.frame_height, 
                        interpolation=cv2.INTER_LINEAR,
                        borderMode=cv2.BORDER_WRAP)
return out

then you don't need the handcrafted _bilinear_interpolation anymore. It produces the same result.

from equirectangular-toolbox.

gogozhu avatar gogozhu commented on June 26, 2024 3

Hi, thanks for your solution. I also encountered this problem.

However, when I tried your solution, I found another issue.

As we know, the first pixel and the last pixel on the latitude of an equirectangular image are continuous, which means the pixel i+1 should be 0 rather than width when the pixel i is the last pixel. Therefor, I think the correct solution should be the following.

First, you can change line 62
x2 = np.add(x0, np.ones(uf.shape).astype(int)) # coords of pixel to top right
to
_x2 = np.add(x0, np.ones(uf.shape).astype(int)) # coords of pixel to top right

Then add the following after line 64:

x2 = np.mod(_x2, self.frame_width)  
y2 = np.minimum(y2, self.frame_height-1)

Finally, in order to correct the bilinear interpolation, the x2 in line 80 and 81 should be changed to _x2.

wa = np.multiply(_x2 - uf, y2 - vf)
wb = np.multiply(_x2 - uf, vf - y0)

Hope it helps.

from equirectangular-toolbox.

KevinHwangKR avatar KevinHwangKR commented on June 26, 2024

Hey, could you tell me how you were able to run this program please?

from equirectangular-toolbox.

Related Issues (3)

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.