Implement the colour image processing chain

Assignment Help Basic Computer Science
Reference no: EM131163459

OBJECTIVE

Design a C or C++ (ANSI standard) program that implements the colour image processing chain converting images captured by CMOS image sensors into true colour RGB images.

BACKGROUND
To satisfy quality requirements, images captured by semiconductor sensors have to be processed before they are passed to higher stages of computer vision systems.
You are provided with two bmp files test1.bmp and test2.bmp, which contain Bayer Pattern CFA data directly captured by CMOS image sensors. The images have resolution 640x480 pixels. The Bayer pattern used in the CMOS sensor is shown below:

1944_Fig.jpg

Fig. 1. Mosaic of the Bayer pattern

Although basic operations with BMP files is not the focus of this assignment and BMP file read/write functions have been implemented for you in the program template assignment1.c, it may be a good idea to get familiar with the BMP file format that is explained below for your information.

The bmp file format stores image data together with supplementary information in the structured binary file. The BMP format uses Litte Endian byte order for short int, int and unsigned int values. It contains three major segments as shown in Fig. 2.

1650_Fig1.jpg


The File Header provides general information that helps file type verification and also indicates the starting position of image data in the file. The File Header structure can be described as follows:
typedef struct
{
char fileMarker1; /* 'B' */
char fileMarker2; /* 'M' */ unsigned int bfSize;
unsigned short unused1; unsigned short unused2;
unsigned int imageDataOffset; /* Offset to the start of image data */
}FileHeader;

The first two characters 'B' and 'M' indicate that this is a BMP file and their presence must be verified before any further analysis takes place. If 'B''M' file markers are correct, this is a BMP file and thus, the value of imageDataOffset indicates the start of image data in the file ( see Fig. 2 ). However, before reading the image data, it is important to know the image width and its height.
This information is stored in the Info Header.

typedef struct
{
unsigned int biSize;
int width; /* Width of the image */
int height; /* Height of the image */ unsigned short planes;
unsigned short bitPix; /* 24 for true colour */ unsigned int biCompression;
unsigned int biSizeImage; int biXPelsPerMeter;
int biYPelsPerMeter; unsigned int biClrUsed; unsigned int biClrImportant;
}InfoHeader;

As images can be considered as 2D arrays, height indicates the number of rows and width indicates the number of columns. Each element of the array contains information about three color components blue, green and red which together can represent any complex color. Thus, each image data element can be described as the following structure:

typedef struct
{
unsigned char b; /* Blue value */
unsigned char g; /* Green value */
unsigned char r; /* Red value */
}Pixel;

Note: All these structures need to be packed when they are defined
( #pragma pack(push, 1) ). Otherwise, your program may insert slack bytes.
Note: BMP files have Little Endian byte order. Test your computer platform first (compile platform platform_test.c and run it) to make sure it is also Little Endian.

Picture elements of true colour images are stored in the Image Data segment sequentially ( see Fig. 3). The total number of Pixel elements is width*height.

1541_Fig2.jpg

Fig. 3. The starting position and the internal structure of Image Data segment.

Picture elements of CFA images are stored in the Image Data segment sequentially too ( see Fig. 4). The total number of unsigned char elements is width*height (the total number of bytes is 3 times less than for true colour images)

2113_Fig3.jpg

DESIGN SPECIFICATION

Bayer pattern picture elements captured by the sensor have been stored in BMP files test1.bmp and test2.bmp. In this assignment you are provided with a template C file assignment1.c that:
- prompts the user to enter the input file name ( test1.bmp or test2.bmp )
- reads content of a specified bmp file with CFA data into a 2D array
- calls the function processCFAImage(...) that you have to complete
- stores the produced true colour RGB image in the output bmb file.

There is no need to use OpenCV library for this assignment. You need to modify assignment1.c (or use it as a basis for your C/C++ solution ) to implement a colour processing chain that includes the following stages:
- CFA Interpolation
- Colour Correction
- Gamma Correction

These stages may be implemented in the function processCFAImage(...). However, it may be better to implement them as three separate functions called from processCFAImage(...) in the required sequence.

You can select any CFA interpolation algorithms for your implementation such as Nearest Neighbor, Bilinear, etc. The requirement is that it must produce an RGB image with the same width and height. The algorithms are not complex, but you need to take into account boundary conditions, as pixels around the image boundary may not have neighboring pixels on one or two sides. Try to find the most efficient and simple solution to interpolate boundary pixels.

Colour Correction is a matrix operation. You should use the following matrix that was optimized for this CMOS image sensor:

2307_Fig4.jpg

Gamma correction should be implemented using a look-up table as described in the lecture notes. The only difference is that the table must map 8-bit values onto 8-bit values. The table entries must be calculated using γ = 0.5 and implement the following transfer function:

743_Fig5.jpg

You need to find the expression how to calculate and fill the table.

The function processCFAImage(...) has the following prototype:
bool processCFAImage( unsigned char **cfaImage,
Pix ** rgbImage, int width,
int height);

Where width and height are cfa (and also rgb) image sizes in pixels. cfaImage is a two dimensional array with CFA Bayer pattern values. rgbImage is a 2D array of RGB image samples that must be produced by your image processing chain. If there are no errors in the function, it returns true. The resulting rgb samples are stored in a bmp file. The produced bmp file can be displayed by any image viewer.

Attachment:- Assignment 1.rar

Verified Expert

This assignment is to write a program to convert Sensor image to true colour RGB colours. it is implemented in C programming language. it uses 3 types of techniques to process the image. they are used in the following order - CFA Interpolation - Colour Correction - Gamma Correction Screenshots are given in word document file. result is stored in the resulttest1.bmp for input image test1.bmp and resulttest2.bmp for input test2.bmp

Reference no: EM131163459

Questions Cloud

What specific language in the u.s. supreme court decision : What specific language in the U.S. Supreme Court decision may have contributed to the ongoing debate to overrule Roe v. Wade?
How the selected literary elements affect narrative theme : Identify at least two of the literary elements in the short story that contribute to the theme (e.g., plot, point of view, tone, setting, character, symbolism, etc.), providing an example of each element.
What quality of harvest hand does she hire and why : A farmer needs a worker (called harvest hand) to help her bring in the harvest. A great harvest hand adds £5000 to the farmer’s revenue. A good harvest hand adds £4000, a decent harvest hand adds £3000 and a bad harvest hand adds £2000 to the farmer’..
Create a mission statement for super sized cycles : Create a mission statement for Super Sized Cycles. Identify the company's target market, the customer need, and the generic business-level strategy
Implement the colour image processing chain : Design a C or C++ (ANSI standard) program that implements the colour image processing chain converting images captured by CMOS image sensors into true colour RGB images.
Freelance reporter is interested and two parties negotiate : A TV station wants a documentary about the Australian outback. A freelance reporter is interested and the two parties negotiate. What is a problem such as in a) called? What is the economic “loss” that it causes? What could the TV station do in order..
Possible outcomes of process : 1. What type of process is the above one: order-to-cash, procure-to-pay or issue-toresolution? 2. Who are the actors in this process? 3. What value does the process deliver to its customer(s)? 4. What are the possible outcomes of this process?
Describe the function of oh and s in the workplace : Describe the function of OH&S in the workplace - Discuss some potential risks associated with computer workstation setup, work organisation and any other relevant risks associated with computer / desk work.
How does this impact goal setting and performance reviews : Based on the literature, summarize the role of followership and its significance in the leadership process. When followers have a participatory role, how does this impact goal setting and performance reviews

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explain applications of pervasive computing

Which of the applications of pervasive computing do you believe are probable to gain greatest market acceptance over next few years? Why?

  Identify heap objects that will be long-lived

What compile-time analyses can be done to identify heap objects that will be long-lived? At run-time, how can we efficiently estimate the "age" of a heap object (so that long-lived heap objects can be specially treated)?

  Why does tcp/ip not specify a single protocol at each layer

Why does TCP/IP not specify a single protocol at each layer?

  Who do the sites promoting these toolsclaim to support

Who do the sites promoting these toolsclaim to support?

  Please share a problem on statistics

1. Please share a problem on statistics and explain how to work the problem. Please show each of your steps. 2. Also. please share a website on Statistics. Do not share a website of a classmate.

  Explain why optimization codes sometimes do not work well

Provide three important reasons Provide three important reasons why optimization codes sometimes do not work well. Explain each in detail.l. Explain each in detail.

  Find entry index to locate the entry to remove

Assuming that the entry is located, what does remove need to do after it gets the index of this entry?

  Give a possible arrangement of subnet masks

Give a possible arrangement of subnet masks to make this possible.

  Determine the hardware to be used and the installation

Determine the hardware to be used and the installation options. How will users log onto the systems. Explain.

  How can organizations in a global market utilize enterprise

How can organizations in a global market utilize Enterprise Content Management technology to maintain governance and control over content in ensuring regulatory compliance

  Layouts and access

Envision that you have been asked to create a Website for a bookstore that sells e-Books. Taking into consideration how customers might log in to shop, determine the type of layout you would use. Explain how you came to this decision.

  Compare and contrast freeware and shareware

Compare and contrast freeware, shareware and commercial software. What are the characteristics of each? Discuss examples.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd