Theoretical experiments on several imaging techniques-1 (Luma-key, chroma-key) (http://www.cnitblog.com/DavidLew)

Source: Internet
Author: User
Key









Symbol and numerical conventions
I. Basic concepts of key
Ii. Luma-Key
Iii. chroma-Key
4. Channel key uses the color channel for image Extraction
5. Color Difference mattes
Vi. DV key
VII. References




















Determine the value and symbol conventions before starting.
The default image space is RGB.
Use the same float as shake to indicate the color value. The color range is from [0-1] 0: Indicates pure white 1: Indicates pure black, and 0.5 indicates 50% gray.
Red is represented by the (, 0) symbol.
R indicates the red channel
G indicates the Green Channel
B Indicates the blue Tunnel
Use Apple shake as the test software.

I. Basic concepts of key

What is Mattes:
Mattes controls the transparency and opacity of other images. Mattes generally contains only one channel and is a black-and-white image. Generally, the black area indicates completely transparent, while the white area indicates completely opaque, while the gray area indicates translucent.
An important operation in digital synthesis is to extract the desired foreground from an image and separate it from the background. This process is called extracting Mattes, also known as keying, that is what we call the image.
There are many kinds of beat methods. In fact, many commercial plug-ins are provided for each synthesis software. What we want to describe here is not how to use these commercial plug-ins, in addition, some basic knowledge and basic imaging techniques in digital synthesis, as well as their principles and applications.
The method to select the image is dependent on your materials, and the shooting materials have some requirements for the early shooting. Therefore, you must analyze the materials before the image preparation. Analyze its brightness range, its color, its occlusion relationship, and its shooting equipment (film photography machine, broadcast DV camera, etc ), analysis of the scope and background to be extracted is usually difficult to meet the requirements of a imaging method. At this time, it is necessary to use multiple methods to achieve the ultimate goal, however, before application, we must first understand the principles of these basic methods so that they can be used flexibly. This is also the purpose of this Article.
If technical means cannot meet the requirements, hand-drawn mask can be used for manual extraction. If dynamic sequence frames are used, a mask animation is required for each frame, however, the workload is very large. You can use the software image to get an "Approximate" matte, and use the hand-drawn mask to reduce the workload.
In order to better facilitate the later stages of image extraction, in the early stage of shooting, in order to better extract the desired area, we usually use blue screen or green screen as the background. Why do we choose blue screen or green screen? There are many explanations for this. You can refer to the section that uses channel operations to perform image extraction.
Below we will introduce several basic methods for image extraction:
Ii. Luma-Key)
The brightness image is created based on the dark and bright parts of the image.
Working principle:
First, convert an image containing an RGB channel to a single-channel black and white image, which represents the bright and dark areas of the image. The following two values will be set to lowvalue and hightvalue. As long as the black and white image values are greater than hightvalue, this value will be set to pure white. If it is smaller than lowvalue, It will be set to pure black. The text above is visualized.

A 3D mountain represents the brightness distribution range of a black-and-white image. A region higher than a mountain represents a higher brightness of an image pixel.
You can use a cutter in Figure 2 to modify the brightness area of the original image.
By performing operations on the brightness area of the black and white images, you can get the matte, which is usually not so perfect, and then perform secondary processing on the matte obtained by using the image brightness, or you can combine the matte generated by other methods to generate the desired matte.
1. convert an RGB image to a single-channel BW (black and white) image.
Brightness Equation
L (brightness) = 0.29 * r + 0.59 * g + 0.12 * B
Use the shake colorx node to implement the formula.

Explanation: The colorx node can be used to control the expression of the rgbaz channel.
Indicates that a black and white image is formed by 29% of the red, 59% of the green, and 12% of the blue,
Because the eyes are sensitive to green, the proportion of green is higher than that of other colors.
2. process this black-and-white image
Now the brightness information of the image has been raised. Now we can process the black-and-white brightness image and get the desired matte.
Lumakey provided by shake, but here we use other shake nodes
To implement and improve a mylumakey.
Is the shake node network and its explanation

You can compare this image with shake's lumakey node, and you will find that the final effect is the same.
Tip: If you want to control the brightness of black and white images, you can use the shake-> color-> lookup node to adjust the entire image with a curve, to achieve the expand effect, you must adjust the RGB curve at the same time.

Summary: The principle process of lumakey is as follows.


3. chroma-Key (chroma)
Understand RGB 3D space:
When we first learned elementary ry in junior high school, we were touched by the concept of coordinate system, which made it easy to visualize the algebra problem and analyze the problem. The common three-dimensional coordinate system is usually represented by XYZ, horizontal, vertical, and vertical directions. If pixel RGB values are used to represent three vector directions, a new coordinate system can be formed. This coordinate system is usually called an RGB space, the RGB value can represent the color on the display, so that the entire RGB space is fully filled with color pixels, that is, the display result. There is actually a lot of color space to see a cube. For example, you are familiar with HSV.

It is the HSV space. We can see a three-dimensional model similar to a cone. Different shapes indicate that their axial implementation equations are different.

If you put an image represented by RGB into this space, you can use this coordinate system to observe and analyze the red, green, and blue color distribution of the entire image, therefore, we can use the method of studying ry to study and process images. Here we will introduce some of the principles of chroma-key, many of which have many concepts and ideas. You can learn from them or develop them. In particular, they will have a better foundation for learning 3D images in the future.


Distribution of an image in RGB space
Vertex distance formula:
In high school, we must have learned two distance formulas in 2D and 3D coordinate systems. We apply them to our RGB space.
Assume that there are two points in the XYZ coordinate system: p1 (R1, G1, B1), P2 (R2, G2, B2), and the distance is D.
Formula for distance between two points in RGB space:

Consider the two pixels P1 and P2. If the colors of these two pixels are close, that is, their RGB values are close to zero, D is close to black, if the colors of two pixels vary greatly, that is
The difference between RGB values is relatively large, so D will be very large, because we implement the convention that the RGB range is between 0 and 1, so if the maximum distance is greater than 1, it will be displayed as white, if it is smaller than 0, it is black.
The blue screen or green screen is used to make the foreground and background very different. Therefore, the above formula can help us generate a distance chart. Because the distance is a single floating point number, the resulting figure is a single channel black and white.

A distance map.
This image assumes that, in the formula, P1 points are in the foreground, and P2 points are a single color image in the background blue. The distance between the two images is obtained. The black behind the girl shows that the blue cloth is similar to the color we want to propose, so the distance is close to the black, and there is very little blue on the girl, so the distance is close to the white, we can be surprised to find that, you can use any color as the comparison color to extract such a distance chart.
There is such a "matte" that we can color the image, such as adding contrast and drawing masks.
After understanding the above, some explanations about the chroma-key will be well understood.
Chroma-key, as its name implies, is to extract matte through tones. As we have said above, if we color our image in advance, for the desired pixel, increase the distance between him and the unwanted pixel colors. for unwanted pixels, reduce the distance between him and the unwanted pixel colors to extract matte.
Chroma-key is to first convert the image to the HSV space, then adjust the entire image to adjust its tone offset, range, saturation offset, range, and so on to achieve the above purpose. There is a good HSV adjustment tool in shake, namely huecurves, which can be used to precisely adjust the image using the hue curve.
It is the parameter area of the huecurves node.

Next we will summarize the above theory and implement the mychroma-key with more powerful adjustment functions in shake.


Contrastlum is used to process the contrast of the image. You can color the distance map in this region. When using huecurves to adjust the color, for example, you can reduce the red range value of bhue, foreground girls wear red-colored clothes. For example, they can increase the red range of rhue to keep the foreground color from the background.

This is also the basic principle of many commercial photo imaging software, because the photo imaging actually removes some parts of the RGB space, for example, in infeno, 3D is used to display the distribution of an image, and the three-dimensional objects in the middle represent the extracted area. In this way, parameters are adjusted for the three-dimensional object or "modeling" is processed, you can get the desired matte.
Based on this idea, you can use the formulas or concepts of ry and the convenient expression nodes provided by Shake to experiment with more interesting pixel or color technology.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.