kinect depth openframeworks

用kinect实现深度裁剪,获取一定返回内的图像,主要代码如下:

    kinect.update();
    if(kinect.isOpened()){
        image.setFromPixels(kinect.getPixelsRef());
         colorImage.setFromPixels(kinect.getPixelsRef());    
        depthImage.setFromPixels(kinect.getDepthPixels());
         tempGrayImage.setFromPixels(kinect.getDepthPixels());  
         monoPixels.setFromPixels(tempGrayImage.getPixels(), 320,240, 1);  
         if (bLearnBakground == true){  
              monoPixels_diff.setFromPixels(tempGrayImage.getPixels(),320,240, 1);  
             bLearnBakground = false;  
         }  
         for (int i = 0; i <320*240; i++){  
             int valtemp = monoPixels[i] - monoPixels_diff[i];  
             if (valtemp < thresholdLow  || valtemp > thresholdHigh){  
                 valtemp = 0;  
             } else {  
                 valtemp = 1000;  
             }  
             grayPixels[i] = (unsigned char)valtemp;  
         }  
        //  paso_openCV.absDiff(grayImage,depthImage);
         paso_openCV.setFromPixels(grayPixels);  
    if(bLearnBakground2==true)
    {
        absdiffimage=paso_openCV;
        bLearnBakground2=false;

    }
    paso_openCV.absDiff(absdiffimage);
    // paso_openCV.setFromPixels(grayPixels);  
    grayImage.warpIntoMe(paso_openCV, entrada, destino_camera_warp);  
image.warpPerspective(entrada2[0], entrada2[1], entrada2[2], entrada2[3]);
    //colorImage.warpPerspective(entrada[0], entrada[1], entrada[2], entrada[3]);
    grayImage.threshold(threshold);  
    grayImage.blur(5);

    /*paso_openCV.absDiff(absdiffimage);
         grayImage.warpIntoMe(paso_openCV, entrada, destino_camera_warp);  
         paso_openCV.threshold(threshold);  
         paso_openCV.blur(5);  */


        
        contourFinderDepth.findContours(grayImage, 20, (320 * 240)/3, 10, true);

作者QQ:715705486

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值