panoList = []
panoDict = {}
cur = 0

with open('example/url_require/' + fileID +
          '_lat_lon_result.json') as data_file:
    SFM_path = json.load(data_file)

pathPoint_set = []
for key, value in SFM_path.iteritems():
    pathPoint_set.append(value)
print len(pathPoint_set)

for i in xrange(0, len(pathPoint_set) - 1):
    pathPoint = pathPoint_set[i]
    pano = streetview_my.GetPanoramaMetadata(lat=pathPoint[0],
                                             lon=pathPoint[1])
    if pano.PanoId not in panoSet:
        panoSet.add(pano.PanoId)
        pano_for_mat = {'Lat':pano.Lat, 'Lon':pano.Lon, 'panoId':pano.PanoId, 'AnnotationLinks':pano.AnnotationLinks, 'ProjectionPanoYawDeg':pano.ProjectionPanoYawDeg,\
            'rawDepth':pano.rawDepth, 'DepthMapIndices':pano.DepthMapIndices, 'DepthMapPlanes':pano.DepthMapPlanes, 'DepthHeader':pano.DepthHeader}
        #pano_for_mat = {'Lat':pano.Lat, 'Lon':pano.Lon, 'panoId':pano.PanoId, 'AnnotationLinks':pano.AnnotationLinks, 'ProjectionPanoYawDeg':pano.ProjectionPanoYawDeg}
        panoDict['street' + str(cur)] = pano_for_mat
        cur = cur + 1

print panoDict.keys(), len(panoDict.keys())

panoMeta = {}
panoMeta['len'] = len(panoDict.keys())
panoMeta['data'] = panoDict

sio.savemat('streetview_set_' + fileID + '.mat', panoMeta)
import json
import scipy.io as sio
import sys
sys.path.append('../Refference/')
import streetview_my

from pprint import pprint

with open('json/metaOnly.json') as data_file:
    data = json.load(data_file)

print data[str(0)]['panoId']

panoDict = {}

cur = 0
pano = streetview_my.GetPanoramaMetadata(data[str(0)]['panoId'])
pano_for_mat = {
    'Lat': pano.Lat,
    'Lon': pano.Lon,
    'panoId': pano.PanoId,
    'AnnotationLinks': pano.AnnotationLinks
}
panoDict['street' + str(cur)] = pano_for_mat
cur += 1

panoMeta = {}
panoMeta['len'] = len(panoDict.keys())
panoMeta['data'] = panoDict

sio.savemat('streetview_set_onlyMeta_G1.mat', panoMeta)
Exemple #3
0
import numpy as np
import cv2
import scipy.io as sio
import json

fileID = '000994'
start_panoId = 'GqB2wt15OLGdVzm0BIC8SQ'
requireNum = 30
panoSet = set()
panoList = []
panoDict = {}
cur = 0

panoList.append(start_panoId)
panoSet.add(start_panoId)
pano = streetview_my.GetPanoramaMetadata(start_panoId)
pano_for_mat = {
    'Lat': pano.Lat,
    'Lon': pano.Lon,
    'panoId': pano.PanoId,
    'AnnotationLinks': pano.AnnotationLinks,
    'ProjectionPanoYawDeg': pano.ProjectionPanoYawDeg,
    'rawDepth': pano.rawDepth,
    'DepthMapIndices': pano.DepthMapIndices,
    'DepthMapPlanes': pano.DepthMapPlanes,
    'DepthHeader': pano.DepthHeader
}
#pano_for_mat = {'Lat':pano.Lat, 'Lon':pano.Lon, 'panoId':pano.PanoId, 'AnnotationLinks':pano.AnnotationLinks, 'ProjectionPanoYawDeg':pano.ProjectionPanoYawDeg}
panoDict['street' + str(cur)] = pano_for_mat
cur += 1
#!/usr/bin/python

import streetview_my
import numpy as np
import cv2
import scipy.io as sio
import sys
'''
a = np.zeros((200,500));
b = np.zeros((200,500));
s = 'hello'
cv2.imwrite('a.jpg',a);
sio.savemat('a.mat', {'a':a, 'b':b})
sio.savemat('s.mat', {'s':s, 'abc':a})
'''
pano = streetview_my.GetPanoramaMetadata("L5QY_nh7wOUz3Fd4GhpLaA")

e = np.random.random((pano.DepthHeader['numPlanes'], 3)) * 255
height = pano.DepthHeader['panoHeight']
width = pano.DepthHeader['panoWidth']
depthIndex = pano.DepthMapIndices
depthPlane = pano.DepthMapPlanes
data = np.zeros((height, width, 3))
for h in range(0, height):
    for w in range(0, width):
        dIndex = depthIndex[h * width + w]
        data[h][w][:] = e[dIndex, :]
'''
data = np.zeros((height, width, 3))
print (height, width)
for w in range(0, width):