Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwwyyxx committed Dec 24, 2016
1 parent abca31a commit 56c1949
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 18 deletions.
56 changes: 55 additions & 1 deletion README.md
@@ -1 +1,55 @@
# 3D is awesome
# Stereo Pose Machines

![demo](./demo/poster.jpg)

[Video Demo](tbd)

## Dependencies:
+ A Pair of Pylon Cameras
+ Eigen3
+ OpenCV
+ [tensorpack](https://github.com/ppwwyyxx/tensorpack)
+ PyYaml
+ PyOpenGL

## Compile:
```
cd src/cpp && make
```

## Test Cameras:
```
cd src/cpp && ./main.bin
```
Stereo cameras may be detected in any order. To make things consistent, `src/cpp/pylon_camera.cc`
assumes that the camera whose name contains "711" is the first camera. You'll need to change it
for your case.

## Calibrate Cameras:
Use `main.bin` to take images and Kalibr to produce a yaml with the same format in `calibr-1211`.
Change the path in `main.py` to your own calibration results. Also change the undistortion
coefficients in `cpp/camera.hh`.

## Test CPM is working:
Download model to `data/cpm.npy`.
```
cd src/cpp && python2 main.py -t 'cpm-viewer'
```
It will use 2 GPU to run 2 CPMs in parallel.

## Test Visualization is working:
```
cd visualization && python2 main.py ../data/final-demo.npy
```
Its OpenGL bindings doesn't work on some systems (e.g. Ubuntu). Don't know why.

## Run Stereo CPM:
```
cd src/cpp && python2 main.py -t 'cpm3d'
```
This will send 3d point coordinates to `0.0.0.0:8888`. You can use `-h <ip address>` to change the IP.

To start a server (maybe on some other computers) to receive points and visualize:
```
cd visualization && python main-server.py
```
Binary file added data/final-demo.npy
Binary file not shown.
Binary file added demo/poster.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions src/background.py
Expand Up @@ -25,17 +25,7 @@ def segment(self, im):
mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, self.kernel)
mask = cv2.dilate(mask, self.dilate_k)
mask = mask.astype('uint8')

#flags = 8 | cv2.FLOODFILL_FIXED_RANGE
#bfsmask = np.zeros((mask.shape[0]+2,mask.shape[1]+2), dtype='uint8')
#cv2.floodFill(mask, bfsmask, (20,20), 100, 5,5, flags)
#cv2.floodFill(mask, bfsmask, (mask.shape[0]-20,mask.shape[1]-20), 100, 5,5, flags)
#cv2.floodFill(mask, bfsmask, (mask.shape[0]-20,20), 100, 5,5, flags)
#cv2.floodFill(mask, bfsmask, (20,mask.shape[1]-20), 100, 5,5, flags)
#mask = cv2.dilate(mask, self.dilate_k)
#return mask.astype('float32')
return (mask > 10).astype('float32') *255
#return mask.astype('float32') * 255


if __name__ == '__main__':
Expand Down
4 changes: 3 additions & 1 deletion src/main.py
Expand Up @@ -113,7 +113,8 @@ def final():

ctx = zmq.Context()
sok = ctx.socket(zmq.PUSH)
sok.connect('tcp://172.22.45.86:8888')
global args
sok.connect('tcp://{}:8888'.format(args.host))

def cpp_matcher(m1, m2, o1, o2):
o1 = libcpm.Mat(o1)
Expand Down Expand Up @@ -163,6 +164,7 @@ def cpp_matcher(m1, m2, o1, o2):
parser.add_argument('-t', '--task',
choices=['camera-viewer', 'cpm-viewer', 'cpm3d'],
default='cpm-viewer')
parser.add_argument('-h', '--host', default='0.0.0.0')
args = parser.parse_args()
if args.task == 'camera-viewer':
test_cpp_viewer()
Expand Down
3 changes: 1 addition & 2 deletions src/model.py
Expand Up @@ -15,8 +15,7 @@
from tensorpack.tfutils.summary import *
import matplotlib.pyplot as plt

__all__ = ['colorize', 'colorize_all',
'argmax_2d', 'argmean_2d']
__all__ = ['colorize', 'colorize_all', 'argmax_2d', 'argmean_2d']

_CM = plt.get_cmap('jet')
def colorize(img, heatmap):
Expand Down
4 changes: 0 additions & 4 deletions src/patchmatch.py
Expand Up @@ -47,10 +47,6 @@ def take_patch(im, y, x, size):
IPython.embed(config=IPython.terminal.ipapp.load_default_config())
return canvas

def patch_match(small, large):
pass


BG0 = None
BG1 = None

Expand Down

0 comments on commit 56c1949

Please sign in to comment.