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)
The phrase "minimum" means "out of several" is the minimum.In contrast, min(bb[index])
has given the presentation code ushort bb[307200];
only one value, so the compiler is angry.
© 2024 OneMinuteCode. All rights reserved.