Items with no label
3335 Discussions

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

GGyun
Novice
1,887 Views

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

0 Kudos
6 Replies
MartyG
Honored Contributor III
452 Views

One site suggested to people that were trying to reduce noise on the R200, "For R200 data, there is a hardware control to set the minimum depth distance. You can also try setting one of the depth control presets to 3, 4, or 5 for higher outlier rejection."

On that same information source, a couple of people recommended setting the depth control preset to '5' for best noise reduction results. It looks as though the instruction for doing so is SetDSMinMaxZ()

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/setdsminmaxz_device_pxccapture.html SetDSMinMaxZ

During my research, I came across a very nice and probably forgotten about Intel guide to the R200's depth settings.

https://software.intel.com/sites/default/files/Intel%20RealSense%20SDK%20Design%20Guidelines%20R200%20v1_1.pdf https://software.intel.com/sites/default/files/Intel%20RealSense%20SDK%20Design%20Guidelines%20R200%20v1_1.pdf

Regarding the question of detecting the hand with the R200 when it does not have hand tracking: Blob Tracking is probably your best bet for doing that,

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/doc_blob_blob_tracking.html Blob Tracking

0 Kudos
GGyun
Novice
452 Views

How can I set this?? Can you show me example?

0 Kudos
MartyG
Honored Contributor III
452 Views

Do you mean how to set SetDSMinMaxZ ?

This article was the only place where I could find scripts for it (they are in the C++ format).

https://software.intel.com/en-us/forums/realsense/topic/597076 R200 SetDSMinMaxZ() fails with STATUS_DEVICE_FAILED

And here is more information on using blobs.

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_blob_understanding_the_blob_data.html Intel® RealSense™ SDK 2016 R2 Documentation

0 Kudos
GGyun
Novice
452 Views

What is mean 3,4or5 ?

SetDSMinMaxZ parameter is range

0 Kudos
MartyG
Honored Contributor III
452 Views

I sadly could not find an answer for using SetDSMinMaxZ corectly, as I have never used it myself and so have no experience of programming it. Also, there is very little documentation about the function available. There are members of this forum who are far more expert than me on such calculations. Hopefully they can help explain what you need to know.

0 Kudos
idata
Employee
452 Views

Hi Faker,

 

 

Taking this quote as reference "For R200 data, there is a hardware control to set the minimum depth distance. You can also try setting one of the depth control presets to 3, 4, or 5 for higher outlier rejection", one could say that setting the number to 3, 4 or 5 would reduce the reception of outlier data, this means that atypical numbers in a sample will likely be reduced depending on the number you set (3, 4 or 5), where 5 will give you the best results if this is what you're looking for.

 

Regarding the use of SetDSMinMaxZ, I haven't use it before, so I would suggest you to test it on your own to see how it behaves and then implement it on your project.

 

 

Regards,

 

-Pablo
0 Kudos
Reply