Skip to content

Commit

Permalink
add vc++ parallel_for for parallel the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
bill2239 committed Dec 6, 2019
1 parent ca79789 commit d42a087
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stereo matching
==========
Simple CPU implementation from sratch of Block Matching using simple Sum of Square difference, rank transform and census transform as matching cost. Defualt use OpenMP optimization (save about 200ms per image), also have the option to use OpenCV parallel computing (but didn't improve execution time)
Simple CPU implementation from sratch of Block Matching using simple Sum of Square difference, rank transform and census transform as matching cost. Defualt use OpenMP optimization (save about 200ms per image), also have the option to use Visual c++ (for windows user) concurrency module to parallel the code (slower than openMP in my case)
You can either compile the code to executable with gcc or visual studio with Opencv installed. This have been tested in Windows 10.

left image:
Expand All @@ -23,10 +23,10 @@ Clearly, choosing rank transform or census transform as matching cost make dispa

**Usage**

./stereo_mathing -left=<left image> -right=<right image> -max-disparity=<disparity range> -window_size=<window size for block matching> -tranwin_size=<window size for transformation> -output=<output image file> -parallel=<if you want to run parallel version> -cost=<matching cost function ex: rank or census>
./stereo_mathing -left=<left image> -right=<right image> -max-disparity=<disparity range> -window_size=<window size for block matching> -tranwin_size=<window size for transformation> -output=<output image file> -parallel=<if you want to run parallel version> -cost=<matching cost function ex: rank or census> -windows=<yes if you want to use concurrrency module>

**Examples**

./stereo_matching -left=im1.png -right=im2.png -max-disparity=50 -window_size=6 -tranwin_size=7 -output=depth_new.png -parallel=no -cost=rank
./stereo_matching -left=im1.png -right=im2.png -max-disparity=50 -window_size=6 -tranwin_size=7 -output=depth_new.png -parallel=yes -cost=rank -windows=yes


2 changes: 1 addition & 1 deletion ssd_stereo.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma once
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgcodecs.hpp"
Expand Down Expand Up @@ -26,5 +25,6 @@ class Stereo {
Mat rank_transform(Mat image, int tran_size);
Mat census_transform(Mat image, int tran_size);
Mat stereo_match(Mat left, Mat right);
Mat stereo_match_parallel(Mat left, Mat right);

};

0 comments on commit d42a087

Please sign in to comment.