Find a show you like and click the
button. The show will be added to your My Playlist page and updated 24/7 with new videos.
Search Results
0 Views
23:02:21 02/01/12
Gregory Crewdson: Brief Encounters - SXSW 2012 Accepted Film
[LESS INFO] 0 VIEWS | ADDED 23:02:21 02/01/12
Gregory Crewdson: Brief Encounters - SXSW 2012 Accepted Film
Gregory Crewdson: Brief Encounters follows the acclaimed photographer's decade-long quest to create a series of haunting, surreal, and stunningly elaborate portraits of small-town American life. His photographs are like single-frame movies %mdash partly because each composition brims with narrative, partly because he uses cinematic tools such as special effects, hundreds of lights, and huge crews of technicians. As we travel with him %mdash from first inspirations, through countless creative and logistical obstacles, to the instant where all the elements coalesce in a single perfect moment %mdash we realize that, despite their vast scale, Crewdson's images grow from his most intimate dreams and fantasies. From: sxsw Views: 1216 16 ratings Time: 02:16 More in Entertainment
0 Views
23:02:21 02/01/12
Gregory Crewdson: Brief Encounters - SXSW 2012 Accepted Film
[LESS INFO] 0 VIEWS | ADDED 23:02:21 02/01/12
Gregory Crewdson: Brief Encounters - SXSW 2012 Accepted Film
Gregory Crewdson: Brief Encounters follows the acclaimed photographer's decade-long quest to create a series of haunting, surreal, and stunningly elaborate portraits of small-town American life. His photographs are like single-frame movies %mdash partly because each composition brims with narrative, partly because he uses cinematic tools such as special effects, hundreds of lights, and huge crews of technicians. As we travel with him %mdash from first inspirations, through countless creative and logistical obstacles, to the instant where all the elements coalesce in a single perfect moment %mdash we realize that, despite their vast scale, Crewdson's images grow from his most intimate dreams and fantasies. From: sxsw Views: 1316 16 ratings Time: 02:16 More in Entertainment
10 Views
18:00:36 01/04/12
iPhone: Typon - $.99 - Photo & Video
[LESS INFO] 10 VIEWS | ADDED 18:00:36 01/04/12
Type on your images and create beautiful compositions quick and simple.
Chose between various typefaces, scale, rotate, change colors, and share your images via Facebook or email.
Make a greeting card, make art, make some noise, make someone happy and share your thoughts.
1 Views
18:00:36 01/04/12
iPhone: Typon - $.99 - Photo & Video
[LESS INFO] 1 VIEWS | ADDED 18:00:36 01/04/12
Type on your images and create beautiful compositions quick and simple.
Chose between various typefaces, scale, rotate, change colors, and share your images via Facebook or email.
Make a greeting card, make art, make some noise, make someone happy and share your thoughts.
2 Views
18:00:36 01/04/12
iPhone: Typon - $.99 - Photo & Video
[LESS INFO] 2 VIEWS | ADDED 18:00:36 01/04/12
Type on your images and create beautiful compositions quick and simple.
Chose between various typefaces, scale, rotate, change colors, and share your images via Facebook or email.
Make a greeting card, make art, make some noise, make someone happy and share your thoughts.
1 Views
21:01:31 01/03/12
Typon iPhone App Review - DailyAppShow
[LESS INFO] 1 VIEWS | ADDED 21:01:31 01/03/12
Type on your images and create beautiful compositions quick and simple. Chose between various typefaces, scale, rotate, change colors, and share your images via Facebook or email. Make a greeting card, make art, make some noise, make someone happy and share your thoughts.
10 Views
12:00:00 10/07/11
Episode 168: ZOOMING IN!
[LESS INFO] 10 VIEWS | ADDED 12:00:00 10/07/11
The blog post image of the last episode was “recursive”, the image contained the image in it which contained the image in …… Bert wondered how I did it – and here is the video about it. For this blog post I decided to make a much more annoying recursive image – an animation. (Click on the image for a really annoying version ) To do this was way more complicated than I had anticipated before. Details inside. GAP (GIMP Animation Package) would have made the stuff a lot easier, I assume. If you want your image on top of the blog – make one (1000 × 288 pixels) and send it to me at info@meetthegimp.org! A big Thank You! goes out to the guys from the Białostocka Grupa Użytkowników Linuksa, who are donating the server for the Meet the GIMP video files. The TOC 00:30 Header images 01:40 Making a recursive image 02:55 Start with a screenshot 03:30 Screenshot with GIMP 04:40 Copy the layer and scale down 06:00 repeat until enough.... 08:20 Scaling down 09:15 Animate it - with a plan 12:00 Making layer copies 12:45 Scaling the layers 14:00 Aligning the layers 14:15 Measuring 15:00 Making a grid for adjustments 16:15 Really aligning the layers 18:10 Cropping away the invible parts of the layers 18:45 Scaling down 19:00 Setting the image mode to indexed 19:15 Optimizing for GIF animation 20:00 Exporting as GIF 20:10 Thank you to "Białostocka Grupa Użytkowników Linuksa" http://bgul.org/
2 Views
17:14:59 10/06/11
The Ancient Buildings of Pavlopetri - City Beneath the Waves: Pavlopetri - BBC Two
[LESS INFO] 2 VIEWS | ADDED 17:14:59 10/06/11
The Ancient Buildings of Pavlopetri - City Beneath the Waves: Pavlopetri - BBC Two
More about this programme: www.bbc.co.uk The complex mix of expert archaeology, underwater robotics and state of the art graphics allowed the team to piece together the secrets of Pavlopetri, producing spectacular results. Here, team from the Australian Centre for Field Robotics take us through how they worked to solve the puzzle of the city, using an autonomous underwater vehicle, the first time such technology has been used on this scale on a submerged site. Throughout the night, the camera took stereo images under the water to judge the distance between the ruins on the sea floor. The robot captured hundreds of thousands of images, in order to build up a 3D model - allowing the team to create views that would be otherwise impossible. The graphics team carefully built up a 3D map from the layout of the ruins and the uncovered artefacts. The final images of Pavlopetri reveal an intricate portrait of the city around 1600 BC; a city at its advanced peak. From: BBC Views: 151 2 ratings Time: 02:56 More in Science & Technology
10 Views
20:00:00 09/28/11
Episode 167: Exporting Grumpy Bears
[LESS INFO] 10 VIEWS | ADDED 20:00:00 09/28/11
This Blog needed a header image – and it still needs a lot of header images to rotate through. So I created one out of an image of a Berlin Subway station. Nothing much new in here – rotating, cropping to the needed aspect ratio, a bit of curves for better contrast and colours, scaling and sharpening. Finally I added a text layer with the image credits. If you want your image on top of the blog – make one and send it to me at info@meetthegimp.org! But before that I took a little excursion into Shotwell again and explored the Flickr export function. On the day of the last show, Shotwell released a new version. So it’s no need to compile the trunk code – just download the full package.
0 Views
13:39:42 08/30/11
Hurricane Irene From Caribbean To Canada
[LESS INFO] 0 VIEWS | ADDED 13:39:42 08/30/11
Hurricane Irene: From Caribbean to Canada
An animation of satellite observations from August 21 through August 29 showing the birth of Hurricane Irene in the Caribbean and her track over Puerto Rico, Hispaniola, the Bahamas, up the US east coast and into Canada. Irene grew to a Category 2 hurricane on the Saffir-Simpson scale and made landfalls in North Carolina, New Jersey and New York. The GOES-13 cloud images are overlaid on a true-color MODIS map of the entire eastern US and Greater Antilles. Data from NOAA's GOES-13 satellite. From: NASAtelevision Views: 4135 63 ratings Time: 03:09 More in Science & Technology
27 Views
20:29:27 08/02/11
Nanna van Blaaderen: Species
[LESS INFO] 27 VIEWS | ADDED 20:29:27 08/02/11
In her ‘Species’ knitted collection, Nanna van Blaaderen allowed herself to be guided by the idea of offering an alternative for animal skins as a fashion and interior product. Fascinated by the beauty and diversity of the animal kingdom, she designed a series of knitted fabrics that represent the coats and markings of various animal species in their three-dimensional tactility and textures. She drew inspiration from images of animals and animal skins. She elaborated her ideas for the ‘Jaguar’, ‘Zebra’, ‘Cat’, ‘Zebra back’, Giraffe’ and ‘Scale’ knits at the machine.
0 Views
15:25:01 08/02/11
Action man Vladimir Putin climbs wall
[LESS INFO] 0 VIEWS | ADDED 15:25:01 08/02/11
Action man Vladimir Putin climbs wall
Russia's Prime Minister boosts his tough guy image by scaling a climbing wall at a youth camp north of Moscow. Russia's man of action in pictures: www.telegraph.co.uk From: telegraphtv Views: 5223 7 ratings Time: 02:12 More in News & Politics
19 Views
17:15:36 06/16/11
Working with Depth Data
[LESS INFO] 19 VIEWS | ADDED 17:15:36 06/16/11
This video covers the basics of using depth data from Kinect. You may find it easier to follow along by downloading the Kinect for Windows SDK Quickstarts samples and slides .
* [ 00:43 ] Depth data overview
* [ 04:56 ] Initializing the Kinect Runtime
* [ 05:46 ] Using the depth data to create an image
* [ 12:13 ] Using the PlayerIndex Setup
The steps below assume you have setup your development environment as explained in the " Setting Up Your Development Environment " video. Task Setup the Depth Camera event
Designing the UI
Add an image with Width=320 and Height=240 as shown below:
XAML
Setup the Depth Camera Event
Create an instance of the Kinect Runtime outside of the Window_Loaded event. Then, initialize the Runtime to use DepthAndPlayerIndex and UseSkeletalTracking . Finally register for DepthFrameReady event and open the Depth stream as shown below.
C#
//Kinect Runtime Runtime nui = new Runtime(); private void Window_Loaded(object sender, RoutedEventArgs e) { //UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); //register for event nui.DepthFrameReady += new EventHandler(nui_DepthFrameReady); //DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) {}
Visual Basic
Private nui As New Runtime Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 'UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking) 'register for event AddHandler nui.DepthFrameReady, AddressOf nui_DepthFrameReady 'DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex) End Sub Private Sub nui_DepthFrameReady(ByVal sender As Object, ByVal e As ImageFrameReadyEventArgs) End Sub Understanding the PlanarImage byte[] Array
The DepthFrameReady event returns an ImageFrame class that contains a PlanarImage. That PlanarImage contains a byte[] array which contains the distance of each pixel. The array:
* Starts at top left of image
* Moves left to right, then top to bottom
* Represents distance for pixel Calculating Distance
Because there are 2 bytes per pixel (16 bits) representing the distance, you will need to use bitshift operators to get the distance for a particular pixel. The exact bitshifting depends on the ImageType you use
Depth Image Type
Bitshift second byte left by 8
Distance (0,0) = (int)(Bits[0] | Bits[1] > 3 | Bits[1] > 3 | secondFrame > 3 Or CInt(secondFrame) 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; }
Visual Basic
If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If Setting a monochrome intensity
While the previous examples we hard-coded colors, you can also build a monochrome histogram that scales the color range (0-255) proportionally based on the distance range (850-4000).
To get a monochrome appearance, the intensity is applied equally to all three colors (blue, green, red).
C#
//equal coloring for monochromatic histogram var intensity = CalculateIntensityFromDepth(distance); colorFrame[index + BlueIndex] = intensity; colorFrame[index + GreenIndex] = intensity; colorFrame[index + RedIndex] = intensity; const float MaxDepthDistance = 4000; // max value returned const float MinDepthDistance = 850; // min value returned const float MaxDepthDistanceOffset = MaxDepthDistance - MinDepthDistance; public static byte CalculateIntensityFromDepth(int distance) { //formula for calculating monochrome intensity for histogram return (byte)(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))); }
Visual Basic
'equal coloring for monochromatic histogram Dim intensity = CalculateIntensityFromDepth(distance) colorFrame(index + BlueIndex) = intensity colorFrame(index + GreenIndex) = intensity colorFrame(index + RedIndex) = intensity Private Const MaxDepthDistance As Single = 4000 ' max value returned Private Const MinDepthDistance As Single = 850 ' min value returned Private Const MaxDepthDistanceOffset As Single = MaxDepthDistance - MinDepthDistance Public Shared Function CalculateIntensityFromDepth(ByVal distance As Integer) As Byte 'formula for calculating monochrome intensity for histogram Return CByte(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))) End Function Putting it all together
Using the formulas above, we'll now return a byte[] array that has a color value for each pixel based on if the distance for that pixel:
* > 900 = Blue
* > 900 && 2000 = Red
If the pixel represents a player, the color will be yellow/gold.
C#
private byte[] GenerateColoredBytes(ImageFrame imageFrame) { int height = imageFrame.Image.Height; int width = imageFrame.Image.Width; //Depth data for each pixel Byte[] depthData = imageFrame.Image.Bits; //colorFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] colorFrame = new byte[imageFrame.Image.Height * imageFrame.Image.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; var depthIndex = 0; for (var y = 0; y 900 && distance 2000) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 0; colorFrame[index + RedIndex] = 255; } //Color a player if (GetPlayerIndex(depthData[depthIndex]) > 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; } //jump two bytes at a time depthIndex += 2; } } return colorFrame; }
Visual Basic
Private Function GenerateColoredBytes(ByVal imageFrame As ImageFrame) As Byte() Dim height As Integer = imageFrame.Image.Height Dim width As Integer = imageFrame.Image.Width 'Depth data for each pixel Dim depthData() As Byte = imageFrame.Image.Bits 'colorFrame contains color information for all pixels in image 'Height x Width x 4 (Red, Green, Blue, empty byte) Dim colorFrame(imageFrame.Image.Height * imageFrame.Image.Width * 4 - 1) As Byte 'Bgr32 - Blue, Green, Red, empty byte 'Bgra32 - Blue, Green, Red, transparency 'You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent 'hardcoded locations to Blue, Green, Red (BGR) index positions Const BlueIndex As Integer = 0 Const GreenIndex As Integer = 1 Const RedIndex As Integer = 2 Dim depthIndex = 0 For y = 0 To height - 1 Dim heightOffset = y * width For x = 0 To width - 1 Dim index = ((width - x - 1) + heightOffset) * 4 Dim distance = GetDistanceWithPlayerIndex(depthData(depthIndex), depthData(depthIndex + 1)) If distance 900 AndAlso distance 2000 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 0 colorFrame(index + RedIndex) = 255 End If '//Color a player If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If 'jump two bytes at a time depthIndex += 2 Next x Next y Return colorFrame End Function
25 Views
17:15:36 06/16/11
Working with Depth Data
[LESS INFO] 25 VIEWS | ADDED 17:15:36 06/16/11
This video covers the basics of using depth data from Kinect. You may find it easier to follow along by downloading the Kinect for Windows SDK Quickstarts samples and slides .
* [ 00:43 ] Depth data overview
* [ 04:56 ] Initializing the Kinect Runtime
* [ 05:46 ] Using the depth data to create an image
* [ 12:13 ] Using the PlayerIndex Setup
The steps below assume you have setup your development environment as explained in the " Setting Up Your Development Environment " video. Task Setup the Depth Camera event
Designing the UI
Add an image with Width=320 and Height=240 as shown below:
XAML
Setup the Depth Camera Event
Create an instance of the Kinect Runtime outside of the Window_Loaded event. Then, initialize the Runtime to use DepthAndPlayerIndex and UseSkeletalTracking . Finally register for DepthFrameReady event and open the Depth stream as shown below.
C#
//Kinect Runtime Runtime nui = new Runtime(); private void Window_Loaded(object sender, RoutedEventArgs e) { //UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); //register for event nui.DepthFrameReady += new EventHandler(nui_DepthFrameReady); //DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) {}
Visual Basic
Private nui As New Runtime Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 'UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking) 'register for event AddHandler nui.DepthFrameReady, AddressOf nui_DepthFrameReady 'DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex) End Sub Private Sub nui_DepthFrameReady(ByVal sender As Object, ByVal e As ImageFrameReadyEventArgs) End Sub Understanding the PlanarImage byte[] Array
The DepthFrameReady event returns an ImageFrame class that contains a PlanarImage. That PlanarImage contains a byte[] array which contains the distance of each pixel. The array:
* Starts at top left of image
* Moves left to right, then top to bottom
* Represents distance for pixel Calculating Distance
Because there are 2 bytes per pixel (16 bits) representing the distance, you will need to use bitshift operators to get the distance for a particular pixel. The exact bitshifting depends on the ImageType you use
Depth Image Type
Bitshift second byte left by 8
Distance (0,0) = (int)(Bits[0] | Bits[1] > 3 | Bits[1] > 3 | secondFrame > 3 Or CInt(secondFrame) 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; }
Visual Basic
If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If Setting a monochrome intensity
While the previous examples we hard-coded colors, you can also build a monochrome histogram that scales the color range (0-255) proportionally based on the distance range (850-4000).
To get a monochrome appearance, the intensity is applied equally to all three colors (blue, green, red).
C#
//equal coloring for monochromatic histogram var intensity = CalculateIntensityFromDepth(distance); colorFrame[index + BlueIndex] = intensity; colorFrame[index + GreenIndex] = intensity; colorFrame[index + RedIndex] = intensity; const float MaxDepthDistance = 4000; // max value returned const float MinDepthDistance = 850; // min value returned const float MaxDepthDistanceOffset = MaxDepthDistance - MinDepthDistance; public static byte CalculateIntensityFromDepth(int distance) { //formula for calculating monochrome intensity for histogram return (byte)(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))); }
Visual Basic
'equal coloring for monochromatic histogram Dim intensity = CalculateIntensityFromDepth(distance) colorFrame(index + BlueIndex) = intensity colorFrame(index + GreenIndex) = intensity colorFrame(index + RedIndex) = intensity Private Const MaxDepthDistance As Single = 4000 ' max value returned Private Const MinDepthDistance As Single = 850 ' min value returned Private Const MaxDepthDistanceOffset As Single = MaxDepthDistance - MinDepthDistance Public Shared Function CalculateIntensityFromDepth(ByVal distance As Integer) As Byte 'formula for calculating monochrome intensity for histogram Return CByte(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))) End Function Putting it all together
Using the formulas above, we'll now return a byte[] array that has a color value for each pixel based on if the distance for that pixel:
* > 900 = Blue
* > 900 && 2000 = Red
If the pixel represents a player, the color will be yellow/gold.
C#
private byte[] GenerateColoredBytes(ImageFrame imageFrame) { int height = imageFrame.Image.Height; int width = imageFrame.Image.Width; //Depth data for each pixel Byte[] depthData = imageFrame.Image.Bits; //colorFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] colorFrame = new byte[imageFrame.Image.Height * imageFrame.Image.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; var depthIndex = 0; for (var y = 0; y 900 && distance 2000) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 0; colorFrame[index + RedIndex] = 255; } //Color a player if (GetPlayerIndex(depthData[depthIndex]) > 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; } //jump two bytes at a time depthIndex += 2; } } return colorFrame; }
Visual Basic
Private Function GenerateColoredBytes(ByVal imageFrame As ImageFrame) As Byte() Dim height As Integer = imageFrame.Image.Height Dim width As Integer = imageFrame.Image.Width 'Depth data for each pixel Dim depthData() As Byte = imageFrame.Image.Bits 'colorFrame contains color information for all pixels in image 'Height x Width x 4 (Red, Green, Blue, empty byte) Dim colorFrame(imageFrame.Image.Height * imageFrame.Image.Width * 4 - 1) As Byte 'Bgr32 - Blue, Green, Red, empty byte 'Bgra32 - Blue, Green, Red, transparency 'You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent 'hardcoded locations to Blue, Green, Red (BGR) index positions Const BlueIndex As Integer = 0 Const GreenIndex As Integer = 1 Const RedIndex As Integer = 2 Dim depthIndex = 0 For y = 0 To height - 1 Dim heightOffset = y * width For x = 0 To width - 1 Dim index = ((width - x - 1) + heightOffset) * 4 Dim distance = GetDistanceWithPlayerIndex(depthData(depthIndex), depthData(depthIndex + 1)) If distance 900 AndAlso distance 2000 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 0 colorFrame(index + RedIndex) = 255 End If '//Color a player If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If 'jump two bytes at a time depthIndex += 2 Next x Next y Return colorFrame End Function
72 Views
17:15:36 06/16/11
Working with Depth Data
[LESS INFO] 72 VIEWS | ADDED 17:15:36 06/16/11
This video covers the basics of using depth data from Kinect. You may find it easier to follow along by downloading the Kinect for Windows SDK Quickstarts samples and slides .
* [ 00:43 ] Depth data overview
* [ 04:56 ] Initializing the Kinect Runtime
* [ 05:46 ] Using the depth data to create an image
* [ 12:13 ] Using the PlayerIndex Setup
The steps below assume you have setup your development environment as explained in the " Setting Up Your Development Environment " video. Task Setup the Depth Camera event
Designing the UI
Add an image with Width=320 and Height=240 as shown below:
XAML
Setup the Depth Camera Event
Create an instance of the Kinect Runtime outside of the Window_Loaded event. Then, initialize the Runtime to use DepthAndPlayerIndex and UseSkeletalTracking . Finally register for DepthFrameReady event and open the Depth stream as shown below.
C#
//Kinect Runtime Runtime nui = new Runtime(); private void Window_Loaded(object sender, RoutedEventArgs e) { //UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); //register for event nui.DepthFrameReady += new EventHandler(nui_DepthFrameReady); //DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) {}
Visual Basic
Private nui As New Runtime Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 'UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking) 'register for event AddHandler nui.DepthFrameReady, AddressOf nui_DepthFrameReady 'DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex) End Sub Private Sub nui_DepthFrameReady(ByVal sender As Object, ByVal e As ImageFrameReadyEventArgs) End Sub Understanding the PlanarImage byte[] Array
The DepthFrameReady event returns an ImageFrame class that contains a PlanarImage. That PlanarImage contains a byte[] array which contains the distance of each pixel. The array:
* Starts at top left of image
* Moves left to right, then top to bottom
* Represents distance for pixel Calculating Distance
Because there are 2 bytes per pixel (16 bits) representing the distance, you will need to use bitshift operators to get the distance for a particular pixel. The exact bitshifting depends on the ImageType you use
Depth Image Type
Bitshift second byte left by 8
Distance (0,0) = (int)(Bits[0] | Bits[1] > 3 | Bits[1] > 3 | secondFrame > 3 Or CInt(secondFrame) 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; }
Visual Basic
If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If Setting a monochrome intensity
While the previous examples we hard-coded colors, you can also build a monochrome histogram that scales the color range (0-255) proportionally based on the distance range (850-4000).
To get a monochrome appearance, the intensity is applied equally to all three colors (blue, green, red).
C#
//equal coloring for monochromatic histogram var intensity = CalculateIntensityFromDepth(distance); colorFrame[index + BlueIndex] = intensity; colorFrame[index + GreenIndex] = intensity; colorFrame[index + RedIndex] = intensity; const float MaxDepthDistance = 4000; // max value returned const float MinDepthDistance = 850; // min value returned const float MaxDepthDistanceOffset = MaxDepthDistance - MinDepthDistance; public static byte CalculateIntensityFromDepth(int distance) { //formula for calculating monochrome intensity for histogram return (byte)(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))); }
Visual Basic
'equal coloring for monochromatic histogram Dim intensity = CalculateIntensityFromDepth(distance) colorFrame(index + BlueIndex) = intensity colorFrame(index + GreenIndex) = intensity colorFrame(index + RedIndex) = intensity Private Const MaxDepthDistance As Single = 4000 ' max value returned Private Const MinDepthDistance As Single = 850 ' min value returned Private Const MaxDepthDistanceOffset As Single = MaxDepthDistance - MinDepthDistance Public Shared Function CalculateIntensityFromDepth(ByVal distance As Integer) As Byte 'formula for calculating monochrome intensity for histogram Return CByte(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))) End Function Putting it all together
Using the formulas above, we'll now return a byte[] array that has a color value for each pixel based on if the distance for that pixel:
* > 900 = Blue
* > 900 && 2000 = Red
If the pixel represents a player, the color will be yellow/gold.
C#
private byte[] GenerateColoredBytes(ImageFrame imageFrame) { int height = imageFrame.Image.Height; int width = imageFrame.Image.Width; //Depth data for each pixel Byte[] depthData = imageFrame.Image.Bits; //colorFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] colorFrame = new byte[imageFrame.Image.Height * imageFrame.Image.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; var depthIndex = 0; for (var y = 0; y 900 && distance 2000) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 0; colorFrame[index + RedIndex] = 255; } //Color a player if (GetPlayerIndex(depthData[depthIndex]) > 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; } //jump two bytes at a time depthIndex += 2; } } return colorFrame; }
Visual Basic
Private Function GenerateColoredBytes(ByVal imageFrame As ImageFrame) As Byte() Dim height As Integer = imageFrame.Image.Height Dim width As Integer = imageFrame.Image.Width 'Depth data for each pixel Dim depthData() As Byte = imageFrame.Image.Bits 'colorFrame contains color information for all pixels in image 'Height x Width x 4 (Red, Green, Blue, empty byte) Dim colorFrame(imageFrame.Image.Height * imageFrame.Image.Width * 4 - 1) As Byte 'Bgr32 - Blue, Green, Red, empty byte 'Bgra32 - Blue, Green, Red, transparency 'You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent 'hardcoded locations to Blue, Green, Red (BGR) index positions Const BlueIndex As Integer = 0 Const GreenIndex As Integer = 1 Const RedIndex As Integer = 2 Dim depthIndex = 0 For y = 0 To height - 1 Dim heightOffset = y * width For x = 0 To width - 1 Dim index = ((width - x - 1) + heightOffset) * 4 Dim distance = GetDistanceWithPlayerIndex(depthData(depthIndex), depthData(depthIndex + 1)) If distance 900 AndAlso distance 2000 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 0 colorFrame(index + RedIndex) = 255 End If '//Color a player If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If 'jump two bytes at a time depthIndex += 2 Next x Next y Return colorFrame End Function
58 Views
17:15:36 06/16/11
Working with Depth Data
[LESS INFO] 58 VIEWS | ADDED 17:15:36 06/16/11
This video covers the basics of using depth data from Kinect. You may find it easier to follow along by downloading the Kinect for Windows SDK Quickstarts samples and slides .
* [ 00:43 ] Depth data overview
* [ 04:56 ] Initializing the Kinect Runtime
* [ 05:46 ] Using the depth data to create an image
* [ 12:13 ] Using the PlayerIndex Setup
The steps below assume you have setup your development environment as explained in the " Setting Up Your Development Environment " video. Task Setup the Depth Camera event
Designing the UI
Add an image with Width=320 and Height=240 as shown below:
XAML
Setup the Depth Camera Event
Create an instance of the Kinect Runtime outside of the Window_Loaded event. Then, initialize the Runtime to use DepthAndPlayerIndex and UseSkeletalTracking . Finally register for DepthFrameReady event and open the Depth stream as shown below.
C#
//Kinect Runtime Runtime nui = new Runtime(); private void Window_Loaded(object sender, RoutedEventArgs e) { //UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); //register for event nui.DepthFrameReady += new EventHandler(nui_DepthFrameReady); //DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex); } void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e) {}
Visual Basic
Private nui As New Runtime Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) 'UseDepthAndPlayerIndex and UseSkeletalTracking nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking) 'register for event AddHandler nui.DepthFrameReady, AddressOf nui_DepthFrameReady 'DepthAndPlayerIndex ImageType nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex) End Sub Private Sub nui_DepthFrameReady(ByVal sender As Object, ByVal e As ImageFrameReadyEventArgs) End Sub Understanding the PlanarImage byte[] Array
The DepthFrameReady event returns an ImageFrame class that contains a PlanarImage. That PlanarImage contains a byte[] array which contains the distance of each pixel. The array:
* Starts at top left of image
* Moves left to right, then top to bottom
* Represents distance for pixel Calculating Distance
Because there are 2 bytes per pixel (16 bits) representing the distance, you will need to use bitshift operators to get the distance for a particular pixel. The exact bitshifting depends on the ImageType you use
Depth Image Type
Bitshift second byte left by 8
Distance (0,0) = (int)(Bits[0] | Bits[1] > 3 | Bits[1] > 3 | secondFrame > 3 Or CInt(secondFrame) 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; }
Visual Basic
If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If Setting a monochrome intensity
While the previous examples we hard-coded colors, you can also build a monochrome histogram that scales the color range (0-255) proportionally based on the distance range (850-4000).
To get a monochrome appearance, the intensity is applied equally to all three colors (blue, green, red).
C#
//equal coloring for monochromatic histogram var intensity = CalculateIntensityFromDepth(distance); colorFrame[index + BlueIndex] = intensity; colorFrame[index + GreenIndex] = intensity; colorFrame[index + RedIndex] = intensity; const float MaxDepthDistance = 4000; // max value returned const float MinDepthDistance = 850; // min value returned const float MaxDepthDistanceOffset = MaxDepthDistance - MinDepthDistance; public static byte CalculateIntensityFromDepth(int distance) { //formula for calculating monochrome intensity for histogram return (byte)(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))); }
Visual Basic
'equal coloring for monochromatic histogram Dim intensity = CalculateIntensityFromDepth(distance) colorFrame(index + BlueIndex) = intensity colorFrame(index + GreenIndex) = intensity colorFrame(index + RedIndex) = intensity Private Const MaxDepthDistance As Single = 4000 ' max value returned Private Const MinDepthDistance As Single = 850 ' min value returned Private Const MaxDepthDistanceOffset As Single = MaxDepthDistance - MinDepthDistance Public Shared Function CalculateIntensityFromDepth(ByVal distance As Integer) As Byte 'formula for calculating monochrome intensity for histogram Return CByte(255 - (255 * Math.Max(distance - MinDepthDistance, 0) / (MaxDepthDistanceOffset))) End Function Putting it all together
Using the formulas above, we'll now return a byte[] array that has a color value for each pixel based on if the distance for that pixel:
* > 900 = Blue
* > 900 && 2000 = Red
If the pixel represents a player, the color will be yellow/gold.
C#
private byte[] GenerateColoredBytes(ImageFrame imageFrame) { int height = imageFrame.Image.Height; int width = imageFrame.Image.Width; //Depth data for each pixel Byte[] depthData = imageFrame.Image.Bits; //colorFrame contains color information for all pixels in image //Height x Width x 4 (Red, Green, Blue, empty byte) Byte[] colorFrame = new byte[imageFrame.Image.Height * imageFrame.Image.Width * 4]; //Bgr32 - Blue, Green, Red, empty byte //Bgra32 - Blue, Green, Red, transparency //You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent //hardcoded locations to Blue, Green, Red (BGR) index positions const int BlueIndex = 0; const int GreenIndex = 1; const int RedIndex = 2; var depthIndex = 0; for (var y = 0; y 900 && distance 2000) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 0; colorFrame[index + RedIndex] = 255; } //Color a player if (GetPlayerIndex(depthData[depthIndex]) > 0) { //we are the farthest colorFrame[index + BlueIndex] = 0; colorFrame[index + GreenIndex] = 255; colorFrame[index + RedIndex] = 255; } //jump two bytes at a time depthIndex += 2; } } return colorFrame; }
Visual Basic
Private Function GenerateColoredBytes(ByVal imageFrame As ImageFrame) As Byte() Dim height As Integer = imageFrame.Image.Height Dim width As Integer = imageFrame.Image.Width 'Depth data for each pixel Dim depthData() As Byte = imageFrame.Image.Bits 'colorFrame contains color information for all pixels in image 'Height x Width x 4 (Red, Green, Blue, empty byte) Dim colorFrame(imageFrame.Image.Height * imageFrame.Image.Width * 4 - 1) As Byte 'Bgr32 - Blue, Green, Red, empty byte 'Bgra32 - Blue, Green, Red, transparency 'You must set transparency for Bgra as .NET defaults a byte to 0 = fully transparent 'hardcoded locations to Blue, Green, Red (BGR) index positions Const BlueIndex As Integer = 0 Const GreenIndex As Integer = 1 Const RedIndex As Integer = 2 Dim depthIndex = 0 For y = 0 To height - 1 Dim heightOffset = y * width For x = 0 To width - 1 Dim index = ((width - x - 1) + heightOffset) * 4 Dim distance = GetDistanceWithPlayerIndex(depthData(depthIndex), depthData(depthIndex + 1)) If distance 900 AndAlso distance 2000 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 0 colorFrame(index + RedIndex) = 255 End If '//Color a player If GetPlayerIndex(depthData(depthIndex)) > 0 Then 'we are the farthest colorFrame(index + BlueIndex) = 0 colorFrame(index + GreenIndex) = 255 colorFrame(index + RedIndex) = 255 End If 'jump two bytes at a time depthIndex += 2 Next x Next y Return colorFrame End Function












