Kinect Color Frame Form - kinect

I am curious about the format of the Color Frame in Kinect. Is it RGB or BRG + alpha. I think the information coming is in BRG format but could some clarify this for me

I guess, you can select it by declaring a color format. Here's the reference: MSDN

Related

CGContextSetShadowWithColor and Shadow Color

I've been searching for a way of casting inner glow (shadow) on NSImage. And I've landed on this topic. The code given under this topic looks promising. It's an unfamiliar territory for me now. Anyway, I'm stuck with the following line.
CGContextSetShadowWithColor(c,CGSizeMake(0,-1),innerShadowBlurRadius,CGColorGetConstantColor(kCGColorBlack));
More specifically, I don't quite understand the color part. According to the documentation, the last term is CGColorRef, which I have never used. I suppose it's the color type used for Quartz 2D drawing. In other words, specify a color in the language that Quartz 2D understands, maybe? Anyway, the documentation further suggests that there are three color constants. kCGColorWhite, kCGColorBlack, kCGColorClear. Does that mean I cannot specify an RGB color in this respect?
Thank you for your help.
No that's not what it means, and yes, you can specify RGB values; probably just not in the way you might be thinking. Quartz uses something known as CGColorSpaceRef, which you can think of as multidimensional — and each dimension represents a specific color component. An example would be the colors in the RGB color space, as three dimensions (red, green, and blue). The intensity of each component is represented by floating point values, and their range and meaning depends on the color space in question.
This should give you more concise information that you're looking for:
https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGColorSpace/Reference/reference.html#//apple_ref/doc/uid/TP30000949
Specifically take a look at:
CGColorCreateGenericRGB
Creates a color in the Generic RGB color space.
CGColorRef CGColorCreateGenericRGB(
CGFloat red,
CGFloat green,
CGFloat blue,
CGFloat alpha
);
and also the section on Constant Colors

How to check whether an NSImage is GrayScale or RGB?

Is there any way to check an NSImage's color type in OBJC? I wanna know whether the image is GrayScale or RGB. Any suggestions would help, thanks~
If you can get the image's color space (possibly from its underlying CGImage) you could determine the number of components in it. If its < 3 you have a monochrome image.
However an image could still be monochrome and have a color color space.

map to gradient, re-color an image in iOS

What would be the most efficient way to remap the colors of an image to a gradient for iOS? This is defined as "apply a color lookup table to the image" in the Image Magic docs, and generally I think. Is there something built in core image for instance to do this? I know it can be done with ImageMagick code using convert -clut, but not certain that is the most efficient way to do it.
the result of remapping the image to a gradient is as pictured here:
http://owolf.net/uploads/ny.jpg
The basic formula, copied from fraxel's comment is:
1.Open your image as grayscale, and RGB
2.Convert the RGB image to HSV (Hue, Saturation, Value/Brightness) color space. This is a cylindrical space, with hue represented by a single value on the polar axis.
3.Set the hue channel to the grayscale image we already opened, this is the crucial step.
4.Set value, and saturation channels both to maximal values.
5.Convert back to RGB space (otherwise display will be incorrect).

Programmatically, how does hue blending work in photoshop?

In Photoshop you can set a layer's blending mode to be "Hue". If that layer is, for example, filled with blue then it seems to take the layer below and makes it all blue wherever a non-whiteish color exists.
I'm wondering what it's actually doing though. If I have a background layer with a pixel aarrggbb and the layer on top of that is set to blend mode "Hue" and there's a pixel aarrggbb on that layer, how are those two values combined to give the result that we see?
It doesn't just drop the rrggbb from the layer below. If it did that it'd color white and black as well. It also wouldn't allow color variations through.
If a background pixel is 0xff00ff00 and the corresponding hue layer pixel is 0xff0000ff then I'm assuming the end result will just be 0xff0000ff because the ff blue replaces the ff green. But, if the background pixel is 0x55112233 and the hue layer pixel is 0xff0000ff, how does it come up with the shade of blue that it comes up with?
The reason I ask is that I'd like to take various images and change the hue of the image programmatically in my app. Rather than storing 8 different versions of the same image with different colors, I'd like to store one image and color it as needed.
I've been researching a way to replicate that blending mode in javascript/canvas but I've only come up with the "colorize" filter/blend mode. (Examples below)
Colorize algorithm:
convert the colors from RGB to HSL;
change the Hue value to the wanted one (in my case 172⁰ or 0.477);
revert the update HSL to RGB
Note: this is ok on the desktop but it's noticeably slow on a smartphone, I found.
You can see the difference by comparing these three images. Original:
colorize:
Fireworks' "blend hue" algorithm (which I think is the same as Photoshop's):
The colorize filter might be a good substitute.
RGB/HSL conversion question
Hue/Chroma and HSL on Wikipedia
I found an algorithm to convert RGB to HSV here:
http://www.cs.rit.edu/~ncs/color/t_convert.html
Of course, at the bottom of that page it mentions that the Java Color object already has methods for converting between RGB and HSV, so I just used that.

How to replace a color in an image?

I'm in search of a simple algorithm to replace a color in an image with a different one like in this one->
http://en.wikipedia.org/wiki/File:Colorswaphelicon.png
I'm using VB.NET. Can a "flood fill" algorithm be applied for this purpose?
Please provide a link if possible.
Greetings.
If you need to replace a color of a connected area then flood fill may work for you. For changing the color in the whole image check How to: Use a Color Remap Table and Recoloring Images topic.
Edit:
To replace all intensities of a color shade, you can check and replace the color hue (e.g. see How To Converting Colors Between RGB and HLS (HBS)). Specifically, colors with hue and saturation within a certain range of a source color can be changed to colors with original intensity and hue and saturation of the target color.
Also, you may find helpful How to change RGB color to HSV? and HSL in .net.