” CPT105程序课程 辅导、Java编程设计 写作CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020CPT105 CW3 2020The Wonderful, Colourful World of AndrewsDue date: 7/12/2020 – Saturday 7th December at 18:00 – 30% of final markThis assignment has three parts, Parts A, B, C. You will use the existing Color andPicture classes that you have used in your lab classes and create methods tomodify images. Part A will be due on Monday 7th December 2020 (2020/12/7)at 18:00pm, and Parts B and C will be due on Monday 14th December 2020(2020/12/14) at 18:00 pm.We will be using two classes a lot in this project: Color and Picture. The Colorclass provides us An encapsulation for the RGB color component values and islocated in the java.awt package you need to import it. The Picture class allowsyou to write Java programs that manipulate pictures and is provided in thecw3.zip file on Learning Mall.To support you, we have provided a cw3.zip folder on Learning Mall. Thiscontains some sample code, empty methods for you to work with, and a sampleimage.All submission will be via Learning Mall as used throughout this semester, seeend of each part for further instructions.Part A Image Modifications (45% of assignment), DUE Monday 7thDecember 2020 (2020/12/7) at 18:00In Part A, you have to write a method to manipulate an input Picture object asdescribed in the following section. You have to follow the description to producethe correct output. There are 4 tasks to complete, Task A1, A2, A3 are worth10%, A4 is worth 15% . You should submit your individual methods on in theappropriate code runner section of Learning Mall. There are sample correctoutput images in the zip file that you can use to test your method, using thePictures equals method.In all these tasks, you will be marked based on the output images, and you have asample project provided on Learning Mall to use.Part A.1 Tilt (10%)Write a method Picture tilt(Picture picture) to tilt a picture by rotating thepicture 30 degrees clockwise. To rotate a picture by radians counterclockwise,copy the color of each pixel (cols, rows) in the source picture to a target pixel(colt, rowt) whose Coordinates (in int) are given by the following formulas:colt = (int) ( (cols – colc) cos – (rows – rowc) sin + colc )rowt = (int) ( (cols – colc) sin + (rows – rowc) cos + rowc )CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020where colc and rowc are the coordinates (in double) of the center of the width-byheightpicture, computed by:colc = 0.5 (width – 1)rowc = 0.5 (height – 1)Note that you should only copy the pixel if the target pixel is in bounds, so as notto change the dimension of the image. Use black for target pixels with no copiedcolor.For example, an original Andrew and the tilted Andrew is shown below. A fullyworking and perfect image will get full marks, with mark deductions forrepeated attempts.Part A.2 Emboss (10%)Write a method Picture emboss(Picture picture) to add an emboss style effect to apicture by applying the following kernel (see Appendix 1 for information on aKernel Filter:An original Andrew and the embossed Andrew are shown below. A fullyworking and Perfect image will get full marks, with deductions for repeatedsubmissions. For more information about applying a Kernel Filter, please see theappendix at the end of this sheet.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020Part A.3 Blur (10%)Write a method Picture blur(Picture picture) to blur a picture by applying thefollowing kernel (one-ninth in a 9-by-9 diagonal matrix). This means applyingthe diagonal matrix, and then dividing the result by 9:An original Andrew and the blurred Andrew are shown below. A fully workingand perfect image will get full marks, with deductions for repeated submissions.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020Part A.4 Edge Detection (15%)Write a method Picture edge(Picture picture) to perform edge detection of apicture as follows. First convert the picture into a grayscale picture. You canachieve that by simply calling the static grayScale(picture) method, which isprovided as part of the example code, and is similar to the method created inyour lab classes.Picture grayPic = CW3_Example.grayScale(picture);Next, apply these two kernels to each grayscale component (you only need to doone Computation since all three color components of a grayscale picture are thesame) of a pixel, the following:to obtain the value Gx, and the followingto obtain the value Gy.Finally, clamp the value G = Gx2 + Gy2, and the set the color of that pixel to 255 G.An original Andrew and the edge detected Andrew are shown below. A fullyworking and image will get full marks, with deductions for repeatedsubmissions.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020SubmissionSubmit your code for part A to Learning Mall in a similar manner to the weeklyprogramming quizzes (CW1s). Further guidance is provided in your lab classes. Again,the priority is to ensure that your code produces an image, as credit will be givenaccordingly.Part B Creative Image Transforms (30% of assignment), DUE Monday 14thDecember 2020 (2020/12/14) at 18:00In Part B, you have more creativity to create methods to transform images.There Are 2 tasks to complete, both are worth 15% of your grade. In bothmethods, you must draw the original image with a transformed image side byside, and the method must be general and applied to any picture. You shouldsubmit your individual methods on in the appropriate code runner section ofLearning Mall.In all these tasks, you will be marked based on the output images. You shouldtherefore prioritise being able to display an image over a complex transform thatdoes not work.Part B.1 Positional Transform (15%)In Part A1, you applied a positional transform. Now, write a methodpositionalTransform, that will transform the pixel positions of the original picture anddisplay the original and transformed images side by side in the same picture. You havea free choice of how you wish to do this. The original and transform must be drawnon the same image. More creativity will get extra marks! You should experiment andcarry out independent research, and submit it to Learning Mall.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020For example, for 50 marks, you can create a method that produce a mirror image, suchas:You will get more marks for more creative transformations. For 60+ marks, you cancreate a wave effect, for example:Part B.2 Color Transform (15%)Write a method colorTransform that will transform the Color of the pixel of theOriginal picture. You have a free choice of how you wish to do this. The originaland transform must be drawn on the same image. More creativity will get extramarks.For example, for 50 marks, you can create a method that produces a negativepicture effect, such as:CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020For 60+ marks, you can create a see-through-a-glass effect, for example:SubmissionSubmit your code to Learning Mall in the section allocated to Part B. Further guidanceis provided in your lab classes. The priority is to ensure that your code produces animage, as credit will be given accordingly.You should also submit documentation for these questions, as will be discussed in PartC.Part C Documentation (25% of assignment), DUE Monday 14th December2020 (2020/12/14) at 18:00In Part C, you need to complete the design and documentation of the programsyou wrote in the previous parts. This is worth 25% of your overall grade, andwill be Submitted on Learning Mall.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020Class DiagramYou used the Picture class to create your objects. Draw a class diagram. Youmust use a drawing tool of your own, such as Powerpoint, Visio, or an equivalent.You must not use any autogeneration software.ReportYou must submit a written report. You must provide a description (100-150words) for each of the methods you have created in Part B. In each description,you should describe the technical steps in your method, the effect you are tryingto achieve, and how it is creative and meaningful (i.e. a useful effect). Yourreport should also contain 3 sample pictures (these must be new pictures, notthe sample image given) to demonstrate your transforms.SubmissionSubmit your solution for part C online in the CW3 Part C dropbox on Learning Mall.You should submit several files: One design document with your class diagram, the description of eachmethod in Section B, and the code copy and pasted for each method, andyour sample pictures. One .txt file for each .java class file. These documents must NOT be in aZIP archive. The file name must be the class name. Each file must haveyour name/student number in a comment at the top.Notes All of the coding can and should be achieved using the Java resourcescovered in the Iectures so far this semester. You will need to do independent research to investigate possibletransforms in section B Your code must compile in learning mall. If it does not compile, it will get0 marks. A starter set of classes is available on Learning Mall for you to use, as wellas some images. The design should be your own. Shared designs with friends will beconsidered plagiarism.CPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020This assignment is individual work. Plagiarism (e.g. copying materials fromother sources without proper acknowledgement) is a serious academicoffence. Plagiarism and collusion will not be tolerated and will be dealt with inaccordance with the University Code of Practice on Academic Integrity. Individualstudents may be invited to explain parts of their code in person, and if they fail todemonstrate an understanding of the code, no credit will be given for that part ofthe code.Appendix 1: Kernel FilterA kernel filter modifies the pixels in a picture by replacing each pixel with a linearcombination of its neighboring pixels and itself. The matrix that characterizes thelinear Combination is known as the kernel.Specifically, to apply a kernel filter to a picture, perform the following operation foreach RGB components of each pixel p separately: Align the center of the kernel on pixel p. The new component value of pixel p is obtained by multiplying each kernelelement with the corresponding component value, and adding the results.After that, combine the results to get the new color.For example, to apply an emboss kernel filter (see Part A.2 above) to the middle Redcomponent value of 50 of a pixel on some part of a picture:we compute the new value to be= (-2)10 + (-1)20 + (0)30 + (-1)40 + (1)50 + (1)40 + (0)10 + (1)20 + (2)30 = 90.We then Combine that with the similar computation on the Green and Bluecomponents to obtain the new color of the corresponding pixel.Note the following important information about the computation: Periodic boundary conditions. When applying a kernel filter to a pixel near theboundary, some of its neighboring pixels may not exist. In such cases, assume theCPT105 – Introduction to Programming in JavaCPT105Erick Purwanto and Andrew Abel October 2020leftmost column wraps around to the rightmost column, and vice versa; and thetop row Wraps around to the bottom row, and vice versa. For example: Rounding. When applying a kernel filter, the resulting RGB components maybecome fractional if the kernel weights are fractional. Round each RGB componentto the nearest integer, with ties rounding up. Clamping. When applying a kernel filter, the resulting RGB components may notremain between 0 and 255. If an RGB component of a pixel is less than 0, set it to0; if is Greater than 255, set it to 255.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。