I want to output the minimum value from the distance information obtained from the depth sensor.

Asked 2 years ago, Updated 2 years ago, 81 views

Is there any good way?

cout<<min(depth[i])<endl;

I tried it in , but it didn't work.

#include "stdafx.h"     
# include <vector>
# include <algorithm>

using namespace std;

NUI_LOCKED_RECT depthData={0};
depthFrame.pFrameTexture->LockRect(0,&depthData,0,0);
USHORT*depth=(USHORT*)depthData.pBits;

LONG registerX = 0;
LONG registerY = 0;
cv::Mat bufferMat=cv::Mat::zero(height, width, CV_16UC1);
US>ushort*pBuffer=reinterpret_cast<ushort*>(depthData.pBits);
US>ushort bb [307200];

for(inty=0;yy<480;yy++){
    for(int xx=0;xx<640;xx++){
        unsigned int index=yy*640+xx;
        bb[index] = NuiDepthPixelToDepth(pBuffer[index]);
    }
}
for(inty=0;y<480;y++){
    for(intx=0;x<640;x++){
        kinect->NuiImageGetColorPixelCoordinatesFromDepthPixelAtResolution (CAMERA_RESOLUTION, CAMERA_RESOLUTION, 0, x, y, *depth, & registerX, & registerY);
        if((registerX>=0)&(registerX<640)&(registerY>=0)&(registerY<480)){
            bufferMat.at<ushort>(registY, registerX)=*depth;
        }
        depth++;

        int index = x + y * width;
        int z = bb [index];
        // printf("pixel number x%d||y%d, distance information %d\n", x, y, bb[index]);
        cout<<min(bb[index])<endl;

Error

The argument list does not match the instance of the over-toaded function min (argument type ushort)

c++ opencv kinect

2022-09-30 18:11

1 Answers


© 2024 OneMinuteCode. All rights reserved.