Items with no label
3335 Discussions

How to get RGB value for landmark point?

kdaib
Novice
1,913 Views

Hello, i have to aquire RGB value for landmark point, how can i get them?

I had get color image coordinate of landmark point, but it is still not Pixel(x, y).

I would appreciate any help.

Thanks in advance.

0 Kudos
8 Replies
MartyG
Honored Contributor III
562 Views

Can you confirm please if you are trying to get the RGB value for a particular landmark point on the face, rather than just a general point on an image? Thanks!

0 Kudos
kdaib
Novice
562 Views

Hi MartyG,

I have to get the RGB value for a particular landmark point on the face.

0 Kudos
MartyG
Honored Contributor III
562 Views

Your first message suggested that you were trying to get the XY color image coordinate of a face landmark point. That could be done with the PointF32 instruction, which is part of the QueryPoint instruction for querying specific landmark points on the face.

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

I do not personally know of a way that RGB values could be extracted from a face landmark point, just the XY coordinates of that point.

0 Kudos
kdaib
Novice
562 Views
0 Kudos
idata
Employee
562 Views

Hello Daiby,

 

 

Thank you for your interest in the Intel® RealSense™ Technology.

 

 

I'll be needing more to time to come up with information that you may find useful. As MartyG commented, I also don't know if there is a way to acquire that value from the face landmark point.

 

 

As soon as I have relevant information I'll post it here.

 

 

If you have any update or question, don't hesitate to contact us.

 

 

Thank you for your patience.

 

 

Regards,

 

Andres V.
0 Kudos
idata
Employee
562 Views

Hello Daiby,

 

 

I have to inform you that the RealSense SDK does not provide a native way to acquire the RGB value of a single point in an image.

 

 

Although, there are certain methods that you may be interested in:

 

• System.Bitmap.GetPixel, which returns the color of a specific pixel in a bitmap.o For more information, please check this link: https://msdn.microsoft.com/en-us/library/system.drawing.bitmap.getpixel • PXCMImage.ImageData.ToBitmap, this function returns a Bitmap instance from the ImageData. o If you are interested in knowing more about this method, please follow this link: https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?tobitmap_imagedata_pxcmimage.html

 

Please let me know if you find this information useful.

 

 

Have a nice day.

 

 

Regards,

 

Andres V.
0 Kudos
kdaib
Novice
562 Views

Thank you for your suggestion.

I have try the method you mention and I think it works.

Here is the code showing Get Pixel from face region, Set Pixel to a new bitmap, and display only face region.

private void UpdateUI(Bitmap colorBitmap, PXCMRectI32 rect)

{

Color srcColor;

int width = rect.w;

int height = rect.h;

Bitmap dstBitmap = new Bitmap(rect.w, rect.h);

this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate ()

{

if (colorBitmap != null)

{

if (numFacesDetected > 0)

{

for (int i = 0; i < height; i++)

{

for (int j = 0; j < width; j++)

{

srcColor = colorBitmap.GetPixel(j + rect.x, i + rect.y);

dstBitmap.SetPixel(j, i, srcColor);

}

}

ColorImg.Source = ConverBitmap.BitmapToBitmapSource(dstBitmap);

}

}

}));

colorBitmap.Dispose();

}

where colorBitmap is a bitmap convert from PXCMImage, and rect is from face detection.

0 Kudos
idata
Employee
562 Views

Hello Daiby,

 

 

I'm glad to hear that you found the information provided useful.

 

 

Thank you for sharing your experience, the community really appreciates it.

 

 

Have a nice day.

 

 

Regards,

 

Andres V.
0 Kudos
Reply