Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Find the minimum value and it's location from the depth images

I am working depth data which is in the format of 16UC1. I want to find out the min value (greater than 0) with location from the image. I am using the minMaxLoc function but I am getting the error. It may be because of short values. It will be great , if you suggest the way.

int main() { Mat abc = imread("depth272.tiff"); cout << abc.size() << endl;

  imshow("depth_image",abc);
  Mat xyz = abc > 0;
  cout << "abc type: " << abc.type() << "xyz type " << xyz.type() << endl;

  double rmin, rmax;
  Point rMinPoint, pMaxPoint;
  minMaxLoc(abc, &rmin, &rmax, &rMinPoint, &pMaxPoint, xyz);
  int row = rMinPoint.x;
  int col = rMinPoint.y;

waitKey(0); return 0; }

Find the minimum value and it's location from the depth images

I am working depth data which is in the format of 16UC1. I want to find out the min value (greater than 0) with location from the image. I am using the minMaxLoc function but I am getting the error. It may be because of short values. It will be great , if you suggest the way.way. (previously I asked similar question but that question was general http://answers.opencv.org/question/170905/find-the-the-minimum-value-from-the-depth-data/)

int main() { Mat abc = imread("depth272.tiff"); cout << abc.size() << endl;

  imshow("depth_image",abc);
  Mat xyz = abc > 0;
  cout << "abc type: " << abc.type() << "xyz type " << xyz.type() << endl;

  double rmin, rmax;
  Point rMinPoint, pMaxPoint;
  minMaxLoc(abc, &rmin, &rmax, &rMinPoint, &pMaxPoint, xyz);
  int row = rMinPoint.x;
  int col = rMinPoint.y;

waitKey(0); return 0; }