Monday, August 5, 2013

Google Photo Sphere Viewer for.. Desktop! ( Windows / Linux / Mac )

Google has recently pimped up the stock camera app of Android, with the result that it's now very very easy to create so-called PhotoSpheres.
PhotoSpheres are essentially 360 degrees panoramas, constructed out of several shots, that the user can take following the camera app indications.

The results are actually pretty cool, and, at least for my own sake, this tool is quite useful for taking spheres of interiors.
However, there's only one missing thing about photo spheres, that managed to annoy me pretty soon.
It's normally only possible to view these spheres from the android device, whatever it is. If you want to share one with someone else (= also yourself, but on another machine), you can do it through Google+.
There there's a widget that allows to admire these 360 panoramas directly from your favorite browser ( though i haven't tried. So this might actually not be correct).

The catch is... I don't want to use Google+ to share my photo spheres! I want to send one via email to whoever i want. This i think can be true for me (ofc.) but for other people as well, as i believe that the use of these photo spheres could be also professional (imagine interior designers, architects, etc.).
I believe professionals also do not wish to share these panoramas through Google+.

Well, anyway, all this mumbo jumbo to say that this is the reason why i made a QAD  (= QuickAndDirty) PhotoSphereViewer.  It's trivial, it's in Python, it's GPL, and it's even portable (on windows).
For linux users, it's portable too, as your favorite package manager can surely install all the needed dependencies for you.

If you improve it, please let me know :) (there's plenty of improvements possible)
I am also urgently looking for a host for these ~70MB. If anybody has a suggestion of where to host the portable package, please contact me!

otherwise, just enjoy your photo spheres, now on your PC


Link:  PhotoSphereBundle





Documentation
A couple of lines of documentation here:
1) there's no file selector. You have to enter it by hand (or copy paste it from somewhere else)
2) the address has to be in URI (URL, if you will) form. Meaning that your favorite file in
C:\Users\You\Pictures\PANO_ABC.jpg
becomes   file://C:\Users\You\Pictures\PANO_ABC.jpg
(  you can use regular slashes, too).
3) the positive consequence of this fact is that you can pass a regular http:// url to the program, and it will open and display it for you. You can try it with, for example,
http://cdn.thenextweb.com/wp-content/blogs.dir/1/files/2013/05/Horeshoe-Bend-PS-645x250.jpg
http://www.studio8apps.com/wp-content/uploads/2013/05/glass_team_pano_resized.jpg
http://i-cdn.phonearena.com/images/articles/73441-image/google-nexus-4-photo-sphere.jpg

etc. etc. (have fun with google image search)


Known bugs:
It does not work with big panoramas on older graphics chips (like, f.ex. GeForce 6 or maybe even 7 or earlier)


UPDATE:
Now also with a file selector and on GitHub

31 comments:

  1. Works for me on Linux Mint 15 after deleting the countless useless Windows files. :-) I had to install python-opengl package. Thanks

    ReplyDelete
  2. Hello Brian, thanks for the feedback. Yes, the portable python stuff is just for windows, but I thought it was easier to publish just one package for all :-)
    Please let me know, should you decide to improve the viewer! Gtx

    ReplyDelete
  3. hi, cant install on win7. cant find some thing.

    ReplyDelete
  4. Thanks. This works just fine on ubuntu.
    I Didn't need any of the folders. Probably required on windows.


    Having to enter the path of the file/ drag a file into the input field is a little painful.

    So I wrote a small change to photoSphere.py which loads all jpg filenames in the base
    directory into a QComboBox for easy selection :)

    Here's the relevant code


    def initUI(self):

    self.btn = QtGui.QPushButton('OK', self)
    self.btn.move(20, 20)
    self.btn.clicked.connect(self.showDialog)

    #Automatic file list generation code by jithinbp [at] gmail
    self.cb = QtGui.QComboBox(self)
    allfiles = os.listdir('.')
    files = [a for a in allfiles if a.split('.')[1] == 'jpg'] #make a list of image files
    self.cb.addItems(files)
    #----------------------------------------------------------
    self.cb.move(130, 22)

    self.setGeometry(300, 300, 390, 150)
    self.setWindowTitle('Input dialog')
    self.show()

    def showDialog(self):
    global fileUrl
    text = (str(self.cb.itemText(self.cb.currentIndex()) )) #Load the selected file
    fileUrl = text
    QtCore.QCoreApplication.instance().quit()


    Replace those two functions for a smoother experience


    ReplyDelete
  5. Hi Jithin, and thanks for your comment!
    I must admit i wrote the tool in a very short time, so i did not bother too much to add features :)
    But you are certainly right, it gets cumbersome to select files on pc in the current way.

    Therefore i took 5 min, and added a file selection dialog , and updated the package.
    Hope it helps :)

    ReplyDelete
  6. much obliged. It should now be far more useful to the non-coder who
    simply wants to view his photoSpheres quickly :)

    ReplyDelete
    Replies
    1. Could you also add a download link which just contains the 3-4 .py, qt.conf, license, and README files when you have the time? :)
      70+ MB is a fairly large download for users who already have the relevant packages installed. especially Linux users.

      And thanks for introducing me to the inbuilt filebrowser :o
      Imna go make some changes to a bunch of software I've written in the past.:/

      Delete
    2. Hi, I could create a public repository on github or bitbucket, after all, yes :)
      I'll let you know when done :)

      Delete
    3. Done. In case you (or someone else) is interested in contributing, you can be added to the repo :)
      gtx

      Delete
  7. Hello there ,
    at first i'd like to thank you alot , this is a really helpful idea .
    iam using it on a project for my final year in Uni , iam using a raspberry pi and trying to get this to work inside the PI
    but the image doesnt load at all :(
    any idea ?
    i'd really appreciate any help .
    thanks in advance .

    ReplyDelete
    Replies
    1. Hello Munzer, i suspect the reason is that RPi does not have an OpenGL driver, but an OpenGL ES driver, and this app has been made using regular OpenGL.
      I guess it could be easily ported to GLES though, it's very simple, after all

      Delete
    2. thanx for the fast reply, yes i guess this is the case but then again iam not very familiar with the GLES nor OpenGL stuff to be honest ..
      when you say its very simple, do you mean for anyone?
      and if you could give me hints on how to port it to GLES and make everything work fine i'd be very grateful :)
      sorry for any inconvenience.

      Delete
    3. what iam trying to create is a virtual reality Glasses , i get the photospherical photo displayed on video glasses using the RPi, and then use a sensor to record the moevment of the head and translate it into mouse movements so whenever you look and tilt your head to any direction u see the portion of image lying on that direction. that's the basic idea .. i thought it would be helpful if i share it with you.

      Delete
  8. Hi, I've been using the Photosphere since the Nexus 4 first came out and always hated uploading them to a site so I was very excited when I saw your posting and the fact that you had written a program to display them locally....I'm on Windoze 7 and downloaded and extracted the bundle, installed Python but can't figure out what I'm supposed to do then, I've tried to double click the Photoshere.py but it just flashes a window and goes away, then I tried opening it from within python, and it shows me a bunch of code, which when I try to "Run" says missing OpenGL...

    Please help :-)

    Thanks!!!

    Frank

    ReplyDelete
    Replies
    1. As Frank, I have problems on making the application work. I'm a experienced computer user, but not a computer professional. Some brief instructions about how to make it work would be a lot of help. Reading the description, the application seems very useful and I'm anxious on using it.

      Please help :-)

      Thanks!!!

      Víctor

      Delete
    2. Hi Victor (and Frank, i somehow missed his post :))

      In theory it should be very easy to run the viewer, as easy as running the bat file in the root directory, as it is shipped together with a portable python distribution that includes PyOpenGL.
      Also, it does not require you to install python (even though you can have it installed, it wont interfere)

      Can you give me more details on what you tried that did not work?

      Delete
    3. Also, after you run it, you can either search for a local file by clicking the "Choose" button, or you can paste a URL to a photosphere image from the net (like for example https://lh6.googleusercontent.com/-AQ7EIRdgJ70/U1DrS5jxuHI/AAAAAAAA9LM/E9xpUdKAclI/w2509-h1253-no/14+-+1 )

      Delete
    4. Hi Paolo, thanks for your immediate answer. I think that my first problem was with ASCII, as I had my file names in Spanish, some letters didn't work. I fixed that.
      Now, when I try to open an image, a new window opens, with the "PhotoSphere Python Viewer" title, but it remains empty and blocked. After a few minutes, it crashes.
      I wonder if installing Python would be a solution for this. Honestly I don't know what Python is.
      I'm working on W8 and the PhotoSphere pictures are taken by me in a Nexus 5.
      I know that in this point it will be very difficult for you to help me, but I'm sincerely grateful for your interest. Above all, thanks for sharing your work with such a possitive attitude.
      All the best.
      Víctor.

      Delete
    5. Hi Victor, i don't know what hardware configuration you have, but one thing you could try (just to check whether it works) is to resize your image and make it smaller. If that works, then i could try to update the program to support large images also on different hardware :)

      let me know

      Delete
  9. Hello again.
    YES, it worked making the picture smaller, thank you very much!
    BUT I found one problem that I can't know if it's due to the resizing or to the program.
    When displaying full-spherycal images, they are shown perfectly in the program, as in the Android gallery. But when I try an image that has not recorded the full sphere, the program stretches and deforms the image to close the full sphere. The Android viewer keeps a black area around the picture, to complete the sphere without deforming the image. The information that allows Android to set the black area may have disappeard in the resizing process. I wonder if I could open the original non-resized image, wether it would show fine or deformed.
    Again, thanks a lot.

    ReplyDelete
  10. Hi Victor, yes that's a known problem.
    The reason is that i know no easy way to determine the field of view from the picture (maybe it's embedded in the metadata, but i did not bother to check, as i needed for full sphere pictures.)

    In principle correcting this problem should be simple, if this information is given (or, for example, by letting the user choose the FOV)

    I could try to check this out and possibly update the program when i have some time :)

    ReplyDelete
  11. Ok, I will enjoy this version for now and wait anxiously for that update. Thanks for all, best regards.

    ReplyDelete
  12. I didn't get it to work, blew up with an error

    OpenGL.error.GLError: GLError(
    err = 1281,
    description = 'invalid value',
    baseOperation = glTexImage2D,

    with a 6mb photosphere jpg. Not sure what to do about it. I am using Ubuntu 14. I had to load numpy and python opengl as well, but it ran for a very long time and died with the above message.

    Any ideas?

    ReplyDelete
  13. Hi Jim, it might depend on your graphics hw.
    I have an idea on how to fix this once and for all for everybody, but i need some time to also refactor the code appropriately, and support the GPhoto metadata (which are currently happily ignored, assuming that the photosphere is always complete)
    Hope to do it in the not so far future :)

    ReplyDelete
  14. um... but where to download it please?

    ReplyDelete
  15. the host should not be a problem.why not try github

    ReplyDelete
  16. Hi Apolo, this program is simple of use and SOOO helpful. Thanks a lot, man. I was wondering if there is any setting I can change in the extracted file named ''App'' (windows 7 user) in order to make the panning with a fixed vertical axis

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. I am a linux user (mint17.?). I download the file and extract it but there are no instructions to install it. I opened the bat file and the contents of it seemed to be instructions for installing but unfortuatly:

    bmike1@MikesBeast ~/Documents/Programs/PhotoSphereBundle $ .\App\python.exe .\App\PhotoSphere.py
    .Apppython.exe: command not found
    bmike1@MikesBeast ~/Documents/Programs/PhotoSphereBundle $ .\App\python.exe .\App\PhotoSphere.py
    .Apppython.exe: command not found
    bmike1@MikesBeast ~/Documents/Programs/PhotoSphereBundle $ .\App\PhotoSphere.py
    .AppPhotoSphere.py: command not found
    bmike1@MikesBeast ~/Documents/Programs/PhotoSphereBundle $

    Please, how do I install it?

    ReplyDelete
  20. figured out that the python.exe is because python in not included with windows and was taught 'apt-get install python-opengl'. Now I don't know how to use it. It will open one image at a time. Shouldn't you open more than one image and the program will stitch it together?

    ReplyDelete