Ask Your Question

arenillas's profile - activity

2014-09-25 09:37:29 -0500 asked a question DepthImage to Mat (OpenCV)

I am working with a 3d camera that provides a depthimage which is encoded in 32FC1 I need the image in OpenCV format (Mat) in order to access each component as a matrix. I am working on a ROS system, so I receive the image in ROS format.

The problem is that when I have done the transformation, I try to access the Matrix data with Mat::at but I can not see real values. I don't know where the problem is.

Here is my code:

cv_bridge::CvImagePtr cv_ptr;
        cv_ptr = cv_bridge::toCvCopy(pdepth);
    catch (cv_bridge::Exception& e){
        ROS_ERROR("cv_bridge exception: %s", e.what());

    for(uint col = 0; col < 800; col++){
        float d = 8.0;
        for(uint pix = 0; pix < 300; pix++){
            if (cv_ptr-><float>(pix,col) < 32/(0.45814893-0.001529713*pix)) d = cv_ptr-><float>(pix,col);