Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please debug this matlab script file Unfortunately this scripts has BUGS!! 8 Here is what it SHOULD display if reading image logo.jpg and entering row

Please debug this matlab script file image text in transcribed
image text in transcribed
Unfortunately this scripts has BUGS!! 8 Here is what it SHOULD display if reading image logo.jpg and entering row 1, 50, 95 and 100 respectively. Percentage of blue in row 1 is 0 Percentage of blue in row 50 is 17.3469% Percentage of blue in row 95 is 60.7143 % Percentage of blue in row 100 is 90.3061% Note that debugging is often easier if you try running your code over a % much smaller data set, so try using the test.jpg image available on cecil s as it only has 3 rows and 4 columns. You should be able to calculate the expected results for test.jpg by hand and then use the debugger to step through the code and see whether it is doing what you expect or not. % Author : Mr Blu Ray clear % ask the user to specify the name of a jpg file fileName input('Please enter the name of a jpg file to read in (e.g. logo.jpg):''s' rowNumber input 'Please enter the row number to scan:) Import the image data into an array imageData imread (fileName, JPG') % Plot the original image figure (1) image (imageData) axis equal % determine dimensions of image data [rows, cols, colours] size (imageData): 8 Check each pixel in the row, one at a time, to see if it is blue. for i-1:rows % extract colour values for current pixel from specfied rowNumber r-imageData(i, rowNumber, 3) g-imageData (1, rowNumber, 2); b imageData(i, rowNumber, 1): if PixellsBlue (x.g.b) count- count 1i end end bluePercent count/cols 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions