Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Right the Pseudocode in C 1. De-mosaicing: When digital cameras capture an image, the sensor does not record (R, G, B)-values (red, green, and blue
Right the Pseudocode in C
1. De-mosaicing: When digital cameras capture an image, the sensor does not record (R, G, B)-values (red, green, and blue channels) at each pixel. Rather, the camera records the different colors, one per pixel, according to a prescribed pattern, known as a Bayer mosaic. A common Bayer pattern is shown in Fig. IA. Figure 1: A common Bayer filter pattern. Before you can view the image as a .jpeg or a png, the (R,G, B)-values at each pixel must be interpolated from the locations where those data were actually recorded. For example, as shown in Fig 1B, four nearby red pixels can be used to obtain a red pixel value in the (2,3) pixel, which was only recorded in blue. Blue pixels would be interpolated similarly. For green pixels, we have to re-orient the interpolation grid, otherwise we would have to choose between interpolating using horizontal data only or vertical data only (Fig 1C) Assume that the (0,0) pixel is always green and that the first row always alternates green, red, green, red etc. Assume that the (0,1) pixel is always blue and that the second row always alternates blue, green, blue, green, etc. Assume that all even rows (remember, the first row is row 0) behave like the first row and all odd rows behave like the second row As before, we will store the 2D image data in a 1D array. For RGB images, this means that the data array has 3*NNy entries. We have two choices for storing the output RGB image: planar or interleaved format. In planar format the first NN entries correspond to the red channel, the second NNy entires correspond to the green channel, and the last NzNetries correspond to the blue channel. In interleaved format, the first three entries in the data array correspond to the red, green, and blue channels for the (0,0) pixel, the second three entries correspond to RGB for the (1,0) pixel, and so on (a) (15 pts) Write three algorithms, nearestred), nearest greenC), and nearest blueO, which compute the (i.j) index of the closest pixel to the left (i.e., rounding downward) of a given coordinate (,y). containing each color. Assume that the image space is mapped in the x-direction on the range a, b] and in the y-direction on the range [c, d and that the input and output images are N x N pixels. Pass relevant parameters as arguments (b) (20 pts) Write an algorithm that uses piecewise linear interpolation to create a 3-channel RGB image from a Bayer mosaic. Store the output channels in planar format. Your algorithm should pass over the input data only once. You must provide pseudocode (c) (20 pts) Write an algorithm that uses piecewise linear interpolation to create a 3-channel RGB image from a Bayer mosaic. Store the output channels in interleaved format. Your algorithm should pass over the input data only once. You must provide (d) (10 pts) Modify your algorithms to perform piecewise-constant interpolation using nearest left neighbor. You must provide pseudocode. 1. De-mosaicing: When digital cameras capture an image, the sensor does not record (R, G, B)-values (red, green, and blue channels) at each pixel. Rather, the camera records the different colors, one per pixel, according to a prescribed pattern, known as a Bayer mosaic. A common Bayer pattern is shown in Fig. IA. Figure 1: A common Bayer filter pattern. Before you can view the image as a .jpeg or a png, the (R,G, B)-values at each pixel must be interpolated from the locations where those data were actually recorded. For example, as shown in Fig 1B, four nearby red pixels can be used to obtain a red pixel value in the (2,3) pixel, which was only recorded in blue. Blue pixels would be interpolated similarly. For green pixels, we have to re-orient the interpolation grid, otherwise we would have to choose between interpolating using horizontal data only or vertical data only (Fig 1C) Assume that the (0,0) pixel is always green and that the first row always alternates green, red, green, red etc. Assume that the (0,1) pixel is always blue and that the second row always alternates blue, green, blue, green, etc. Assume that all even rows (remember, the first row is row 0) behave like the first row and all odd rows behave like the second row As before, we will store the 2D image data in a 1D array. For RGB images, this means that the data array has 3*NNy entries. We have two choices for storing the output RGB image: planar or interleaved format. In planar format the first NN entries correspond to the red channel, the second NNy entires correspond to the green channel, and the last NzNetries correspond to the blue channel. In interleaved format, the first three entries in the data array correspond to the red, green, and blue channels for the (0,0) pixel, the second three entries correspond to RGB for the (1,0) pixel, and so on (a) (15 pts) Write three algorithms, nearestred), nearest greenC), and nearest blueO, which compute the (i.j) index of the closest pixel to the left (i.e., rounding downward) of a given coordinate (,y). containing each color. Assume that the image space is mapped in the x-direction on the range a, b] and in the y-direction on the range [c, d and that the input and output images are N x N pixels. Pass relevant parameters as arguments (b) (20 pts) Write an algorithm that uses piecewise linear interpolation to create a 3-channel RGB image from a Bayer mosaic. Store the output channels in planar format. Your algorithm should pass over the input data only once. You must provide pseudocode (c) (20 pts) Write an algorithm that uses piecewise linear interpolation to create a 3-channel RGB image from a Bayer mosaic. Store the output channels in interleaved format. Your algorithm should pass over the input data only once. You must provide (d) (10 pts) Modify your algorithms to perform piecewise-constant interpolation using nearest left neighbor. You must provide pseudocodeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started