Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with exercise 1 Enter the following code at the MATLAB prompt: A=ones (16,16); A=A* 255; B=zeros (16,16); C=[A B;B A]; colormap(gray); image(C)
Please help me with exercise 1
Enter the following code at the MATLAB prompt: A=ones (16,16); A=A* 255; B=zeros (16,16); C=[A B;B A]; colormap(gray); image(C) [comment] Using the help command of MATLAB (MATLAB 2015a or later version) if necessary, write comments next to this code, so as to explain in detail what it does. Also, if necessary, experiment a little, to understand the reasons for each line. For example, omit line 2 to see what happens. Then, to obtain the same results without line 2, you will need to use imagesc(C) instead of image(C). [explanation] Also try omitting the colormap function. [observation] By the same process as in line 4 of the above code, use matrix C as a building block to build a matrix D of dimensions 128 x 128. Note that matrix D should still have a chessboard-like pattern. [labeled printout] The function image plots the matrix in the bracket as if it were an image. This is not a conversion that can be used outside MATLAB's environment. To convert the matrix to one of the standard image file formats you must use the imwrite function as shown in help imwrite using a .tif extension ! The .tif file will be saved in MATLAB's working directory (see MATLAB directory within the Documents library of Windows 7). Actually, this may turn out to not be enough, because MATLAB may not give the .tif file the proper header. To complete the task you need to use a photo-editor, such as Corel PaintShop Pro X5 or later version. From within the photo editor browse to MATLAB's working directory and open the .tif file you created in MATLAB. Immediately save the file as .tif, overwriting the existing one. Now go to NI Vision Assistant (or Vision Builder) via Start - Programs Through the File menu, browse to the .tif file and open it. You have succeeded in bringing into Vision Assistant a file that you created in MATLAB. Go on exploring Vision Assistant. Finally, create a file in NI Vision Assistant and read it into MATLAB as a matrix, as follows: Open one of the example images of IMAQ, say Bracket1.jpg. Go to the Grayscale menu and click on Threshold. Notice the new window that appears. It is called Threshold parameter window. It contains three histograms. Move the threshold cursor to about 80 and then to about 150. Click OK. The resulting binary image should be showing a clear outline of the object. Save this image into MATLAB's working directory. Return to MATLAB and use the imread function to read this image as a matrix. Record the exact MATLAB line you used: Exercise 1: Working as above, create a 512 512 matrix with the opposite chessboard pattern (white boxes become black and vice versa). Make an image plot of this matrix. [labeled plot]Step 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