Advertisement
alex1984vn

convert disparity to depth

Dec 11th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. for(int i = 0; i < depthmap->height; i=i+1){
  2.             for(int j = 0; j < depthmap->width; j=j+1){
  3.                 //if(cvGet2D(depthmap, i, j).val[0] > 90 && cvGet2D(depthmap, i, j).val[0] < 160){
  4.                 if(cvGet2D(depthmap, i, j).val[0] > 25){
  5.                     float depth = 255.0*25.0/(cvGet2D(depthmap, i, j).val[0]+1);
  6.                     //if(depth > 3) depth = 3;
  7.                     cvSet2D(depthmap, i, j, cvScalarAll(depth));   
  8.                 }
  9.                 else{
  10.                     cvSet2D(depthmap, i, j, cvScalarAll(255)); 
  11.                 }
  12.             }
  13.         }
  14.         cvNormalize(depthmap,depthmap,0,255,CV_MINMAX);
  15.         cvNot(depthmap, depthmap);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement