-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Owens
authored and
Andrew Owens
committed
Jan 11, 2015
0 parents
commit 9ffdfcd
Showing
20 changed files
with
7,453 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.pyc | ||
*.o | ||
*.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2014 Andrew Owens | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Code for the CVPR 2014 paper: | ||
Camouflaging an Object from Many Viewpoints | ||
Andrew Owens, Connelly Barnes, Alex Flint, Hanumant Singh, William Freeman. | ||
|
||
- Requires some Python libraries (numpy, scipy, pylab, skimage, | ||
networkx), and Cython. All of these come with the (free) Anaconda | ||
Python distribution: https://store.continuum.io/cshop/anaconda/. | ||
|
||
- If you want to use the MRF-based models, you'll need to build the | ||
Cython code. Just run "make", and it should compile (feel free to | ||
email us if there are any problems with this!). You'll also need to | ||
install GCO 3.0 (http://vision.csd.uwo.ca/code/gco-v3.0.zip). You | ||
can set it up by running "lib/download.sh" | ||
|
||
- To try out the code, run "camo.test_camo()". This camouflages a box | ||
and generates a webpage that shows each viewpoint. | ||
|
||
- Please let us know if you have any questions about the code! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Download graph cuts code | ||
wget http://vision.csd.uwo.ca/code/gco-v3.0.zip && mkdir gco-3.0 && unzip gco-v3.0.zip -d gco-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GCO_FILES=../lib/gco-3.0/GCoptimization.cpp ../lib/gco-3.0/graph.cpp ../lib/gco-3.0/maxflow.cpp ../lib/gco-3.0/LinkedBlockList.cpp | ||
|
||
# | ||
# #CYTHON_CMD=g++ -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing `python-config --libs` -L`python-config --prefix`/lib -static `python-config --ldflags` `python-config --includes` -I `python -c "import numpy; print numpy.get_include()"` | ||
# CYTHON_CMD=g++ -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing `python-config --libs` -L`python-config --prefix`/lib `python-config --ldflags` `python-config --includes` -I `python -c "import numpy; print numpy.get_include()"` | ||
# | ||
CYTHON_CMD=g++ -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing `python-config --libs` -L`python-config --prefix`/lib `python-config --ldflags` `python-config --includes` -I `python -c "import numpy; print numpy.get_include()"` | ||
|
||
|
||
#-I `python-config --prefix`/lib/python2.7/site-packages/numpy/core/include | ||
|
||
mrf : mrf.pyx mrf.cc mrf.h | ||
g++ -c -O3 -fPIC -I ../lib/gco-3.0 mrf.cc $(GCO_FILES) | ||
cython mrf.pyx -o mrf_.c | ||
$(CYTHON_CMD) mrf_.c mrf.o GCoptimization.o LinkedBlockList.o graph.o maxflow.o -o mrf.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Automatically reload all of the modules in the current directory | ||
# or its subdirectories every time you enter a command in IPython. | ||
# Usage: from the IPython toplevel, do | ||
# In [1]: import autoreload | ||
# autoreload enabled | ||
# Very similar to %autoreload. | ||
|
||
import os, sys, traceback | ||
|
||
def relative_module(m): | ||
return hasattr(m, '__file__') \ | ||
and ((not m.__file__.startswith('/')) \ | ||
or m.__file__.startswith(os.getcwd())) | ||
|
||
def reload_all(): | ||
# Reloading __main__ is supposed to throw an error | ||
# For some reason in ipython I did not get an error and lost the | ||
# ability to send reload_all() to my ipython shell after making | ||
# changes. | ||
excludes = set(['__main__', 'autoreload']) | ||
for name, m in list(sys.modules.iteritems()): | ||
# todo: Check source modification time (use os.path.getmtime) to see if it has changed. | ||
if m and relative_module(m) and (name not in excludes) and (not hasattr(m, '__no_autoreload__')): | ||
reload(m) | ||
|
||
def ipython_autoreload_hook(self): | ||
try: | ||
reload_all() | ||
except: | ||
traceback.print_exc() | ||
print 'Reload error. Modules not reloaded.' | ||
|
||
def enable(): | ||
try: | ||
import IPython | ||
ip = IPython.get_ipython() | ||
prerun_hook_name = 'pre_run_code_hook' | ||
except: | ||
try: | ||
# IPython 0.11 | ||
import IPython.core.ipapi as ipapi | ||
prerun_hook_name = 'pre_run_code_hook' | ||
ip = ipapi.get() | ||
except: | ||
# IPython 0.10.1 | ||
import IPython.ipapi as ipapi | ||
prerun_hook_name = 'pre_runcode_hook' | ||
ip = ipapi.get() | ||
ip.set_hook(prerun_hook_name, ipython_autoreload_hook) | ||
print 'autoreload enabled' | ||
|
||
# # taken from ipy_autoreload.py; should probably just use that instead | ||
# def superreload(module, reload=reload): | ||
# """Enhanced version of the builtin reload function. | ||
# superreload replaces the class dictionary of every top-level | ||
# class in the module with the new one automatically, | ||
# as well as every function's code object. | ||
# """ | ||
# module = reload(module) | ||
# # iterate over all objects and update them | ||
# count = 0 | ||
# for name, new_obj in module.__dict__.items(): | ||
# key = (module.__name__, name) | ||
# if _old_objects.has_key(key): | ||
# for old_obj in _old_objects[key]: | ||
# if type(new_obj) == types.ClassType: | ||
# old_obj.__dict__.update(new_obj.__dict__) | ||
# count += 1 | ||
# elif type(new_obj) == types.FunctionType: | ||
# update_function(old_obj, | ||
# new_obj, | ||
# "func_code func_defaults func_doc".split()) | ||
# count += 1 | ||
# elif type(new_obj) == types.MethodType: | ||
# update_function(old_obj.im_func, | ||
# new_obj.im_func, | ||
# "func_code func_defaults func_doc".split()) | ||
# count += 1 | ||
# return module | ||
|
||
|
||
# automatically enable when imported | ||
__no_autoreload__ = True | ||
|
||
#enable() | ||
|
||
|
Oops, something went wrong.