6 Replies Latest reply on Feb 17, 2017 10:55 AM by Intel Corporation

    How can delete noise of R200 (Blob) and How can detect Handgesture

    FakerSenBBai

      void updateBlobImage(PXCImage* depthFrame)

        {

        if (depthFrame == nullptr) {

        return;

        }

       

       

        // Blob 데이터 업데이트

        auto sts = blobData->Update();

        if (sts < PXC_STATUS_NO_ERROR) {

        return;

        }

       

       

       

       

        PXCImage::ImageInfo depthInfo = depthFrame->QueryInfo();

        ContourImage = cv::Mat::zeros(depthInfo.height, depthInfo.width, CV_8U);

       

       

        auto session = sm->QuerySession();

        depthInfo.format = PXCImage::PIXEL_FORMAT_Y8;

        PXCImage* blobImage = session->CreateImage(&depthInfo);

       

       

        // Blob 개수

        int numOfBlobs = blobData->QueryNumberOfBlobs();

        for (int i = 0; i < numOfBlobs; ++i) {

        // Blob NEAR_TO_FAR

        PXCBlobData::IBlob* blob;

        PXCBlobData::AccessOrderType accessOrder = PXCBlobData::ACCESS_ORDER_NEAR_TO_FAR;

       

       

        // Blob is queried according to image segmentation type (color/depth)

        PXCBlobData::SegmentationImageType segmentationType = PXCBlobData::SegmentationImageType::SEGMENTATION_IMAGE_DEPTH;

        blobData->QueryBlob(i, segmentationType, accessOrder, blob);

        if (sts < PXC_STATUS_NO_ERROR) {

        continue;

        }

       

       

        // Blob됪몴귩롦벦궥귡

        sts = blob->QuerySegmentationImage(blobImage);

        if (sts < PXC_STATUS_NO_ERROR) {

        continue;

        }

       

       

        // Blob됪몴귩벶귒뜛귔

        PXCImage::ImageData data;

        pxcStatus sts = blobImage->AcquireAccess(PXCImage::Access::ACCESS_READ,

        PXCImage::PIXEL_FORMAT_Y8, &data);

        if (sts < PXC_STATUS_NO_ERROR) {

        continue;

        }

       

       

        // 긢??귩긓긯?궥귡

        for (int j = 0; j < depthInfo.height * depthInfo.width; ++j) {

        if (data.planes[0][j] != 0) {

        // 귽깛긢긞긏긚궸귝궯궲갂륡뼞귩빾궑귡

        ContourImage.data[j] = (i + 1) * 64;

        }

        }

       

       

        // Blob됪몴귩됶뺳궥귡

        blobImage->ReleaseAccess(&data);

       

       

        // Blob궻쀖둺귩?렑궥귡

        updateContoursImage(blob, i);

        }

       

       

        // 됶뺳궥귡궴긄깋?궸궶귡

        //blobImage->Release();

        }

       

       

        void updateContoursImage(PXCBlobData::IBlob* blob, int index)

        {

        // 블롭 찾기

        auto numOfContours = blob->QueryNumberOfContours();

        for (int i = 0; i < numOfContours; ++i) {

        // 외곽선 찾기

        PXCBlobData::IContour* contour;

        blob->QueryContour(i, contour);

        pxcI32 size = contour->QuerySize();

        if (size <= 0) {

        continue;

        }

        // ?귽깛긣봹쀱궻둴봃

        if (points.size() < size) {

        points.reserve(size);

        }

       

       

        // 쀖둺궻?귩롦벦궥귡

        //auto sts = blob->QueryContourPoints(i, points.size(), &points[0]);

        auto sts = contour->QueryPoints(points.size(), &points[0]);

        if (sts < PXC_STATUS_NO_ERROR) {

        continue;

        }

       

       

        // 쀖둺궻?귩?됪궥귡

        drawContour(&points[0], size, index);

        }

        }

        void drawContour(PXCPointI32* points, pxcI32 size, int index)

        {

        // ?궴?귩멄궳뙅귆

        for (int i = 0; i < (size - 1); ++i) {

        const auto& pt1 = points[i];

        const auto& pt2 = points[i + 1];

        cv::line(ContourImage, cv::Point(pt1.x, pt1.y), cv::Point(pt2.x, pt2.y),

        cv::Scalar(((index + 1) * 127)), 5);

        }

       

       

        // 띍뚣궻?궴띍룊궻?귩멄궳뙅귆

        const auto& pt1 = points[size - 1];

        const auto& pt2 = points[0];

        cv::line(ContourImage, cv::Point(pt1.x, pt1.y), cv::Point(pt2.x, pt2.y),

        cv::Scalar(((index + 1) * 127)), 5);

        }

       

       

      how can delete noise ??

      and Is there any way to detect hand?(R200)

      R200 not support Hand detection