finding the dinstance using x,y coordinates from the color of pixels from the kinect RRS feed

  • Question

  •   How do I retrieve the color from the color stream pixels? I was trying to find out if a specific pixel was green, blue, red, purple, and so on at specific x,y coordinates. I think I am about halfway done is their anything I am missing?

      Private Sub SensorColorFrameReady(ByVal sender As Object, ByVal e As ColorImageFrameReadyEventArgs)
                Using colorFrame As ColorImageFrame = e.OpenColorImageFrame()
                    If colorFrame IsNot Nothing Then
                        ' Copy the pixel data from the image to a temporary array
                        ' Write the pixel data into our bitmap
                        Me.colorstreamBitmap.WritePixels(New Int32Rect(0, 0, Me.colorBitmap.PixelWidth, Me.colorBitmap.PixelHeight), Me.colorPixels, Me.colorBitmap.PixelWidth * Len(New Integer), 0)
                    End If
                    Dim a As CoordinateMapper
                    a = sensor.CoordinateMapper()
                    a.MapDepthFrameToColorFrame(DepthImageFormat.Resolution640x480Fps30, Me.depthPixels, ColorImageFormat.RgbResolution640x480Fps30, colorpoints)
                    Dim i As Integer
                    If IsNothing(depthPixels) = False Then
                        a.MapColorFrameToDepthFrame(ColorImageFormat.RgbResolution640x480Fps30, DepthImageFormat.Resolution640x480Fps30, Me.depthPixels, Me.depthPoints)
                        For i = 0 To depthPixels.Length - 1
                            If depthPoints(i).X = colorpoints(i).X Then
                            End If
                        Next i
                    End If
                End Using
            End Sub
    Besides the above, I would like to convert the colorpixels to ARGB values to match with System.Windows.Media.Colors. Then, I would like to retrieve the x,y coordinates of the left most pixel with the specific color on the object and the x,y coordinates of the right most pixel with a specific color on the object. Finally, I want to repeat this for the top left, bottom left, top right, and bottom right coordinates.

    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog -

    Monday, March 31, 2014 3:20 PM

All replies