Learning Outcomes Upon successful completion of this practical task you will be able to: • Apply a problem-solving metho

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

Learning Outcomes Upon successful completion of this practical task you will be able to: • Apply a problem-solving metho

Post by answerhappygod »

Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 1
Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 1 (50.62 KiB) Viewed 32 times
Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 2
Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 2 (19.82 KiB) Viewed 32 times
Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 3
Learning Outcomes Upon Successful Completion Of This Practical Task You Will Be Able To Apply A Problem Solving Metho 3 (51.51 KiB) Viewed 32 times
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-255 R-235 RO 6 - 255 G = 0 B-0 B = 25$ B=0 R=0 G-255 0 = 255 B-0 Cyan R-O G= 255 B= 25 Red R-255 G-0 B-o Blue R=0 Magenta Go 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, G and 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 colored Chips.png. This image is an in-built image in MATLAB available through the Image Processing Toolbox. Figure 3: 'colored Chips.png' image.
Points to be addressed: Also think about the logic needed to check for other coloured pixels. 1.e. What sort of values might you look for in primary colours (red, green, blue)? What about secondary colours such as cyan, magenta or yellow? E.g. yellow pixels generally have red and green values that are greater than 127 and blue values that are less than 127. Think about the conditional statement structure and the logical expression(s) you'll need to write to check for this.
Exercise: Now think about the algorithm you'll need to use to do this task, write out the logic on paper and turn this into a flow-chart. It may help to use the logic exercise in the box below to work out in your mind how you would logically do this task and how this could then translate to a computer. Logic Task: Use the grid below to work out how you would logically check the colour of each square in the grid then change red squares to black How would you increment from one square to the next in a row to check each colour? How would you increment each row to check the entire grid? Use the row/column indices (1-13) provided to help with this. Write the step-by-step process in your notes, this will become your algorithm. 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2 3 4 5 6 7 В 9 10 11 12 13
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply