Practical Exercise 2: Image Colours Learning Outcomes Upon successful completion of this practical task you will be able

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Practical Exercise 2: Image Colours Learning Outcomes Upon successful completion of this practical task you will be able

Post by answerhappygod »

Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 1
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 1 (62.44 KiB) Viewed 40 times
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 2
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 2 (58.79 KiB) Viewed 40 times
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 3
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 3 (56.13 KiB) Viewed 40 times
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 4
Practical Exercise 2 Image Colours Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able 4 (80.97 KiB) Viewed 40 times
Practical Exercise 2: Image Colours Learning Outcomes Upon successful completion of this practical task you will be able to: • Apply a problem-solving methodology to create a computer solution that changes the colours in an RGB colour image. Become familiar with the structure and flow of conditional and iterative statements in MATLAB. Introduction to the practical Background of colour replacement: In photography and video applications colour replacement is a useful tool. In photography this technique could be used to change a colour in a photograph to another colour, for example changing the colour of a red chocolate wrapper to blue (below). In video applications similar techniques are used to replace a block of colour in a video stream (such as green or blue) to a completely different background or image, this is called chroma- keying or 'green-screening and is how the weather is often performed on the news; the weather presenter is usually standing in front of a green-screen and the green is replaced with a weather map, which is what you see on your television.
The RGB colour-space: To understand how this is possible we need to understand how colour is represented on a computer (and in MATLAB). The most common way colour is represented is using what's known as the RGB colour-space (R = red, G = green, B = blue). When looking at an image on a computer screen it will be made up of rectangular light elements called pixels (a portmanteau of 'picture elements), the colour of these pixels will be determined by the ratios of red, green and blue light being emitted by the screen. For example, a pure red pixel would be emitting red light only (red turned on), while the green and blue light would be turned off. Cyan (greeny-blue) would have red light turned off with roughly equal parts green and blue light being emitted. Below are the primary and secondary light colours and their RGB values; 255 represents 100% on, 0 represents completely off. Green Yellow White Black R=0 R=255 R=255 R = 0 G-255 G = 255 G - 255 o=0 BO B=0 B-0 B-255 Cyan R-O G=255 B-255 Red R - 255 G - 0 B=0 Blue R = 0 Magenta oo R = 255 B - 255 G-0 B = 255 Figure 1: Primary and secondary colour wheel and RGB values.
On top of this you also have shades, pixels are not just binary 'on' or 'off' elements but can be dimmed or brightened to emit more or less light to create many different colours and shades, this is shown below for pure red pixels. Figure 2: Pure red pixels. R value is increasing from 0 - 255 from left to right, Gand B values are set to zero throughout Part 1: Designing a colour change program For this prac you'll be designing a program that: a. Prompts a user to specify a colour they want to change in an image, b. Iterates through the image and changes all pixels of that colour to black, and c. Displays the resultant image in a new figure window. The image you will be using is shown in figure 3 and is an image of plastic chips called coloredChips.png. This image is an in-built image in MATLAB available through the Image Processing Toolbox Figure 3: 'colored Chips.png' image.
Part 2: Create a User-defined function for program For this part of the prac you'll be taking your colour change program and the algorithm you designed in tasks 3 & 4 and will convert this so the search and colour-change part of the algorithm is performed in a user-defined function. Task 5 - Write, run and test your user-defined function Exercise: Now, in a new MATLAB script file write a user-defined function that will perform the search algorithm and the colour-changing: Your main script should continue to contain the part of the program that prompts your user what colour they want changed. Your main script should also continue to handle the displaying of the images Your user-defined function should now take in the image and which colour to change and then perform the search and colour change process. Your user-defined function should also output the processed image back to your main script. Points to be addressed: Compare the output image to what you would expect to get from your handworked algorithm in task 3. Make sure this is still what you expect and troubleshoot your code if it's not. Make sure to present thorough evidence of testing your program with a wide range of inputs in your report. Also, make sure to clearly present your program's output with a discussion on how well it fulfils the requirements of the task in your report (strengths and weaknesses). Lastly, check the report guidelines on Canvas (under the Week 1 Module -> Assessment Task Instructions (IMPORTANT) -> Practical Instructions) to make sure you've covered all aspects of the problem solving methodology adequately.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply