Full Transcript

Camera Mechanism we will discuss some of the basic camera concepts, like aperture, shutter, shutter speed, and ISO and we will discuss the collective use of these concepts to capture a good image. Aperture The aperture is a small opening that allows the light to travel inside the camera. Here is the...

Camera Mechanism we will discuss some of the basic camera concepts, like aperture, shutter, shutter speed, and ISO and we will discuss the collective use of these concepts to capture a good image. Aperture The aperture is a small opening that allows the light to travel inside the camera. Here is the picture of the aperture. You will see some small blade-like stuff inside the aperture. These blades create an octagonal shape that can be opened and closed. And thus it makes sense that, the more blades will open, the hole from which the light would have to pass would be bigger. The bigger the hole, the more light is allowed to enter. Effect The effect of the aperture directly corresponds to the brightness and darkness of an image. If the aperture opening is wide, it would allow more light to pass into the camera. More light would result in more photons, which ultimately results in a brighter image. Consider these two photos The one on the right side looks brighter, which means that when it was captured by the camera, the aperture was wide open. As compared to the other picture on the right bottom side, which is darker as compared to the first one, shows that when that image was captured, its aperture was not wide open. Size Now let’s discuss the Math behind the aperture. The size of the aperture is denoted by a f value. And it is inversely proportional to the opening of the aperture. Here are the two equations, that best explain this concept. Large aperture size = Small f value Small aperture size = Greater f value Pictorially it can be represented as: Shutter After the aperture, there comes the shutter. The light when allowed to pass from the aperture, falls directly onto the shutter. A shutter is actually a cover, a closed window, or can be thought of as a curtain. Remember when we talked about the CCD array sensor on which the image is formed? Well behind the shutter is the sensor. So, the shutter is the only thing that is between the image formation and the light when it is passed from the aperture. As soon as the shutter is open, light falls on the image sensor, and the image is formed on the array. Effect If the shutter allows light to pass a bit longer, the image would be brighter. Similarly, a darker picture is produced, when a shutter is allowed to move very quickly and hence, the light that is allowed to pass has very less photons, and the image that is formed on the CCD array sensor is very dark. Shutter speed The shutter speed can be referred to as the number of times the shutter gets open or close. Remember we are not talking about for how long the shutter gets open or closed. Shutter time The shutter time can be defined as: When the shutter is open, the amount of wait time it takes till it is closed is called shutter time. In this case, we are not talking about how many times, the shutter got open or closed, but we are talking about how much time it remains wide open. For example: We can better understand these two concepts in this way. Let’s say that a shutter opens 15 times and then gets closed, and for each time it opens for 1 second and then gets closed. In this example, 15 is the shutter speed and 1 second is the shutter time. Relationship The relationship between shutter speed and shutter time is that they are both inversely proportional to each other. This relationship can be defined in the equation below. More shutter speed = less shutter time. Less shutter speed = more shutter time. Explanation: The less the time required, the more is the speed. And the greater the time required, the less the speed. Applications These two concepts together make a variety of applications. Some of them are given below. Fast-moving objects: If you were to capture the image of a fast-moving object, could be a car or anything. The adjustment of shutter speed and its time would affect a lot. So, to capture an image like this, we will make two amendments: Increase shutter speed Decrease shutter time What happens is, that when we increase the shutter speed, the more number of times, the shutter would open or close. It means different samples of light would be allowed to pass in. And when we decrease the shutter time, it means we will immediately capture the scene, and close the shutter gate. If you will do this, you get a crisp image of a fast-moving You set your shutter speed to 1 second and you capture a photo. This is what you get Then you set your shutter speed to a faster speed and you get. Then again you set your shutter speed to even more faster and you get. You can see in the last picture, that we have increase our shutter speed to very fast, that means that a shutter get opened or closed in 200th of 1 second ISO ISO factor is measured in numbers. It denotes the sensitivity of light to camera. If the ISO number is lowered, it means our camera is less sensitive to light and if the ISO number is high, it means it is more sensitive. Effect The higher the ISO, the brighter the picture would be. IF ISO is set to 1600, the picture would be very bright and vice versa. Side effect If the ISO increases, the noise in the image also increases. Today most of the camera manufacturing companies are working on removing the noise from the image when ISO is set to higher speed. Pixel Concept of Pixel Pixel is the smallest element of an image. Each pixel corresponds to any one value. In an 8-bit grayscale image, the value of the pixel is between 0 and 255. The value of a pixel at any point corresponds to the intensity of the light photons striking at that point. Each pixel stores a value proportional to the light intensity at that particular location. PEL A pixel is also known as PEL. In the figure, there may be thousands of pixels, that together make up this image. We will zoom that image to the extent that we can see some pixels division. It is shown in the image below. Relationship with CCD array We have seen how an image is formed in the CCD array. So, a pixel can also be defined as the smallest division of the CCD array is also known as a pixel. Each division of the CCD array contains the value against the intensity of the photon striking. This value can also be called as a pixel. Calculation of the total number of pixels We have defined an image as a two-dimensional signal or matrix. Then in that case the number of PEL would be equal to the number of rows multiplied by several columns. This can be mathematically represented as below: Total number of pixels = number of rows X number of columns Or we can say that the number of (x, y) coordinate pairs makes up the total number of pixels. We will look in more detail in the slides of image types, that how we calculate the pixels in a color image. Gray level The value of the pixel at any point denotes the intensity of the image at that location, and that is also known as the gray level. We will see in more detail the value of the pixels in the image storage and bits per pixel tutorial, but for now, we will just look at the concept of only one-pixel value. Pixel value.(0) We will now look at a unique value of 0. The value 0 means the absence of light. It means that 0 denotes dark, and it further means that whenever a pixel has a value of 0, it means at that point, a black color would be formed. Have a look at this image matrix 0 0 0 0 0 0 0 0 0 Now this image matrix has all filled up with 0. All the pixels have a value of 0. If we were to calculate the total number of pixels from this matrix, this is how we are going to do it. Total no of pixels = total no. of rows X total no. of columns = 3 X 3 = 9. It means that an image would be formed with 9 pixels, and that image would have a dimension of 3 rows and 3 columns and most importantly that image would be black. The resulting image that would be made would be something like this Now why is this image all black? Because all the pixels in the image had a value of 0. Perspective Transformation When human eyes see near things they look bigger as compared to those who are far away. This is called perspective in a general way. Whereas transformation is the transfer of an object, etc., from one state to another. So overall, the perspective transformation deals with the conversion of a 3d world into a 2d image. The same principle on which human vision works and the same principle on which the camera works. We will see in detail why this happens, that those objects which are near to you look bigger, while those who are far away, look smaller even though they look bigger when you reach them. We will start this discussion with the concept of a frame of reference: Frame of reference: A frame of reference is a set of values about which we Transformation between these 5 frames That’s how a 3d scene is transformed into 2d, with an image of pixels. Now we will explain this concept mathematically. Where Y = 3d object y = 2d Image f = focal length of the camera Z = distance between the image and the camera Now there are two different angles formed in this transform which are represented by Q. The first angle is Where minus denotes that the image is inverted. The second angle that is formed is: Comparing these two equations we get From this equation, we can see that when the rays of light reflect after striking the object, and passing from the camera, an inverted image is formed. For example Calculating the size of the image formed Suppose an image has been taken of a person 5m tall, and standing at a distance of 50m from the camera, and we have to tell that the size of the image of the person, with a camera of focal length, is 50mm. Solution: Since the focal length is in millimeters, we have to convert everything in millimeters to calculate it. So, Y = 5000 mm. f = 50 mm. Z = 50000 mm. Putting the values in the formula, we get = -5 mm. Again, the minus sign indicates that the image is Concept of Bits Per Pixel Bpp or bits per pixel denotes the number of bits per pixel. The number of different colors in an image depends on the depth of color or bits per pixel. Bits in mathematics: It’s just like playing with binary bits. How many numbers can be represented by one bit? 0 1 How many two-bit combinations can be made? 00 01 10 11 If we devise a formula for the calculation of total number of combinations that can be made from bit, it would be like this. The number of different colors: Now as we said it in the beginning, the number of different colors depends on the number of bits per pixel. The table for some of the bits and their color is given below. Bits per pixel Number of colors 1 bpp 2 colors 2 bpp 4 colors 3 bpp 8 colors 4 bpp 16 colors 5 bpp 32 colors 6 bpp 64 colors 7 bpp 128 colors 8 bpp 256 colors 10 bpp 1024 colors 16 bpp 65536 colors 24 bpp 16777216 colors 16.7millioncolors 32 bpp 4294967296 colors 4294millioncolors Color values: Black color: Remember, the 0-pixel value always denotes black color. But no fixed value denotes white color. White color: The value that denotes white color can be calculated as : In the case of 1 bpp, 0 denotes black, and 1 denotes white. In case 8 bpp, 0 denotes black, and 255 denotes white. Gray color: When you calculate the black and white color value, then you can calculate the pixel value of the gray color. The gray color is actually the midpoint of black and white. That said, In the case of 8bpp, the pixel value that denotes gray color is 127 or 128bpp ifyoucountfrom1, notfrom0. Image storage requirements After the discussion of bits per pixel, now we have everything that we need to calculate the size of an image. Image size The size of an image depends upon three things. Number of rows Number of columns Number of bits per pixel The formula for calculating the size is given below. Size of an image = rows * cols * bpp It means that if you have an image, let’s say this one: Assuming it has 1024 rows and it has 1024 columns. And since it is a grayscale image, it has 256 different shades of gray or it has bits per pixel. Then putting these values in the formula, we get Size of an image = rows * cols * bpp = 1024 * 1024 * 8 = 8388608 bits. But since it’s not a standard answer that we recognize, so will convert it into our format. Converting it into bytes = 8388608 / 8 = 1048576 bytes. Converting into kilo bytes = 1048576 / 1024 = 1024kb. Converting into Mega bytes = 1024 / 1024 = 1 Mb. That’s how an image size is calculated and it is stored. Now in the formula, if you are given the size of the image and the bits per pixel, you can also calculate the rows and columns of the image, provided the image is squaresamerowsandsamecolumn. Types of Images There are many types of images, and we will look in detail at different types of images and the color distribution in them. The binary image The binary image as its name states contains only twopixel values. 0 and 1. Here 0 refers to black color and 1 refers to white color. It is also known as Monochrome. Black and white image: The resulting image that is formed hence consists of only black and white color and thus can also be called a Black and White image. No gray level One of the interesting things about this binary image is that there is no gray level in it. Only two colors, black and white are found in it. Format Binary images have a format of PBM ( Portable bit map ) 2, 3, 4, 5, 6-bit color format The images with a color format of 2, 3, 4, 5, and 6 bits are not widely used today. They were used in old times for old TV displays, or monitor displays. But each of these colors has more than two gray levels and hence has a gray color, unlike the binary image. In a 2-bit 4, in a 3-bit 8, in a 4-bit 16, in a 5-bit 32, in a 6-bit 64 different colors are present. 8-bit color format The 8-bit color format is one of the most famous image formats. It has 256 different shades of colors in it. It is commonly known as a grayscale image. The range of the colors in 8 bit vary from 0-255. Where 0 stands for black, and 255 stands for white, and 127 stands for 16-bit color format It is a color image format. It has 65,536 different colors in it. It is also known as a high-color format. It has been used by Microsoft in their systems that support more than 8-bit color format. Now this 16bit format and the next format we are going to discuss which is a 24-bit format are both color formats. The distribution of color in a color image is not as simple as it is in a grayscale image. A 16-bit format is actually divided into three further formats which are Red, Green, and Blue. The famous (RGB) format. It is pictorially represented in the image below. Now the question arises, how would you distribute 16 into three? If you do it like this, 5 bits for R, 5 bits for G, 5 bits for B Then there is one bit that remains in the end. So, the distribution of 16-bit has been done like this. 5 bits for R, 6 bits for G, 5 bits for B. The additional bit that was left behind is added into the green bit. Because green is the color that is most soothing to the eyes in all of these three colors. Note this distribution is not followed by all the systems. Some have introduced an alpha channel in the 16-bit. Another distribution of 16-bit format is like this: 4 bits for R, 4 bits for G, 4 bits for B, and 4 bits for alpha channel. Or some distribute it like this 5 bits for R, 5 bits for G, 5 bits for B, and 1 bits for alpha channel. 24-bit color format 24-bit color format also known as true color format. Like 16bit color format, in a 24-bit color format, the 24-bit are again distributed in three different formats Red, Green, and Blue. Since 24 is equally divided into 8, it has been distributed equally between three different color channels. Their distribution is like this. 8 bits for R, 8 bits for G, 8 bits for B. Behind a 24-bit image. Unlike an 8-bit gray scale image, which has one matrix behind it, a 24bit image has three different matrices of R, G, and B. Format It is the most commonly used format. Its format is PPM ( Portable pixMap) which is supported by the Linux operating system. The famous Windows has its format for it which is BMP Color Codes Conversion we will see how different color codes can be combined to make other colors, and how we can convert RGB color codes to hex and vice versa. Different color codes All the colors here are of the 24-bit format, which means each color has 8 bits of red, 8 bits of green, and 8 bits of blue, in it. Binary color format Color: Black Decimal Code: Image: (0,0,0) Color:White Image: Decimal Code: (255,255,255) RGB color model: Color: Red Image: Decimal Code: (255,0,0) Explanation: Since we need only red color, we zero out the rest of the two portions which are green and blue, and we set the red portion to its maximum which is 255. Color: Green Image: Decimal Code: (0,255,0) Explanation: Since we need only green color, we zero out the rest of the two portions which are red and blue, and we set the green portion to its maximum which is 255. Color: Blue Image: Decimal Code: (0,0,255) Explanation: Since we need only blue color, we zero out the rest of the two portions which are red and green, and we set the blue portion to its maximum which is 255 Color: Gray Image: Decimal Code: (128,128,128) Explanation: As we have already defined in our tutorial of pixels, that gray color Is actually the midpoint. In an 8-bit format, the midpoint is 128 or 127. In this case, we choose 128. So, we set each of the portions to its midpoint which is 128, and that resulted in an overall mid value and we got a gray color. CMYK color model: CMYK is another color model where c stands for cyan, m stands for magenta, y stands for yellow, and k for black. CMYK model is commonly used in color printers in which there are two carters of color used. One consists of CMY and the other consists of black color. The colors of CMY can also made by changing the quantity or portion of red, green, and blue. Color: Cyan Image: Decimal Code: (0,255,255) Explanation: Cyan color is formed from the combination of two different colors which are Green and blue. So, we set those two to maximum and we zero out the portion of red. And we get cyan color. Color: Magenta Image: Decimal Code: (255,0,255) Explanation: Magenta color is formed from the combination of two different colors which are Red and Blue. So, we set those two to maximum and we zero out the portion of green. And we get magenta color. Color: Yellow Image: Decimal Code: (255,255,0) Explanation: Yellow color is formed from the combination of two different colors which are Red and Green. So, we set those two to maximum and we zero out the portion of blue. And we get yellow color.