Skip to content

Commit

Permalink
- fix the code to work with the trunk of OR
Browse files Browse the repository at this point in the history
- add the possibility to only submit object_i
  • Loading branch information
Vincent Rabaud committed Dec 15, 2011
1 parent 50e19be commit 975babc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifest.xml
Expand Up @@ -9,7 +9,7 @@
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/object_recognition_household_object_database_sync</url>
<depend package="household_objects_database"/>
<depend package="object_recognition"/>
<depend package="object_recognition_core"/>

</package>

Expand Down
16 changes: 12 additions & 4 deletions object_sync.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
import roslib; roslib.load_manifest('object_recognition')
import roslib; roslib.load_manifest('object_recognition_core')
import object_recognition
from object_recognition import dbtools, models
import couchdb
Expand All @@ -10,7 +10,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Search for an objects in the DB based on tags..')
parser.add_argument('-t', '--tag', metavar='TAG', dest='tag', type=str, default='',
help='Tag to search for.')
object_recognition.dbtools.add_db_options(parser)
parser.add_argument('--object_ids', help='If set, it overrides the list of object_ids in the config file', default=None)
object_recognition.dbtools.add_db_arguments(parser)
args = parser.parse_args()
return args
def meshlab(filename_in, filename_out):
Expand All @@ -24,7 +25,14 @@ def househould_insert(thumbnail, meshfile, obj):
args = parse_args()
couch = couchdb.Server(args.db_root)
db = dbtools.init_object_databases(couch)
results = models.Object.by_object_name(db)
if vars(args).get('object_ids', None):
results = []
object_ids = eval(vars(args).get('object_ids'))
for obj in models.Object.all(db):
if obj.id in object_ids:
results.append(obj)
else:
results = models.Object.by_object_name(db)
import os
if not os.path.exists('scratch'):
os.makedirs('scratch')
Expand All @@ -39,7 +47,7 @@ def househould_insert(thumbnail, meshfile, obj):

with open(png, 'w') as imagef:
imagef.write(image.read())
meshes = models.Model.by_object_id_and_mesh(db, key=obj.id, limit=1).rows
meshes = models.Model.by_object_id_and['mesh'](db, key=obj.id, limit=1).rows
if len(meshes) == 0:
sys.stderr.write("No mesh for object %s, skipping!\n" % (str(obj.id)))
continue
Expand Down

0 comments on commit 975babc

Please sign in to comment.