联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2024-02-29 08:30

DATED 2024-02-01 (minor revisions over previous draft)

PLEASE SEE LATEST VERSION ON CANVAS AS THIS ONE MAY CHANGE

CS-256 Visual Computing Assignment (only 1 assignment, worth 20% of module)

Date set : Friday 2nd February 2024 at 13:00

Deadline : Monday 4th March 2024 at 11:00

Viva booking: An Eventbrite link will be posted on Canvas closer to submission.

By submitting this coursework, electronically and/or hardcopy, you state that you fully understand

and are complying with the university's policy on Academic Integrity and Academic Misconduct. The

policy can be found at https://myuni.swansea.ac.uk/academic-life/academic-misconduct.

Guidance: A lot of guidance for this assignment will be given in the lectures and support will be given

in the assignment advisory classes.

Unfair Practice: Do not copy code from colleagues, internet or other sources. You may discuss

approaches together, but all coding must be your own. Presenting work other than your own at a viva

is plagiarism and a recipe for disaster. The application that you demonstrate must be the code

submitted to Canvas. To demonstrate code which is different to that submitted will count as Academic

Misconduct.

Aims

Understand how an image is stored internally, and how to manipulate the image

Translate useful graphics algorithms into working code

Improve your programming skills through self-study and a challenging assignment

Combine interaction with visual feedback

Practice presenting your work in a viva situation

Individuals or pairs

You may complete and submit the assignment as an individual or as a pair (two students working

together). If done as a pair, you must both attend the viva at the same time and indicate that your

submission is joint (so you both get the marks). Do not do it in a team of more than two people. Do not

split as a team once you have decided to work together as your solutions may be duplicates.

Files:

The supporting framework is written in Java. You may use and build on this framework. If you wish to

carry out the coursework in a different language you may do so, but there will be no provided

framework. You will be required to demonstrate your working program on 7/3/2024 or 14/3/2024.

You will require a copy of the Java template downloaded from Canvas. It demonstrates how to display

and manipulate images, with functions that will help you with the exercise.

[Note: You should not redistribute the template code anywhere – you will not have permission to do that]

Assignment Summary:

1. Implement Gamma correction [30 marks]

2. Implement image resizing [30 marks]

3. Implement cross correlation [40 marks]

You do not have to do the assignment in the above order.

Exercise Details:

1. Implement Gamma correction

This should be done using the gamma correction equation, and for full marks, using the look

up table approach. This can be accomplished by watching the "coding Gamma correction"

video. Every student should be able to get 30% by watching and following the coding in the

video and using the provided base code. It is OK if your code is like mine in the video.

2. Image resizing

Implement image resizing using nearest neighbour interpolation and bilinear interpolation.

There are also details about how to do this in the “coding Gamma correction” video. I go as far

as demonstrating code for nearest neighbour interpolation. This (with Gamma correction) is

enough to get 45% on the assignment.

3. Cross correlation with Laplacian

Implement the cross correlation (weighted sum) of a filter with a pixel (and its neighbourhood)

as a function and use that for all pixels in the image to create the intermediate image.

Implement normalisation on an intermediate image to create a new cross-correlated and

normalised image for display. Use the following filter as input. This will achieve the full marks

for this part. You can further experiment with passing different filters (e.g., you could have a

radio button that switches between different filters). This would not attract further marks,

but you may like to do it as a challenge and to understand this part of the course more deeply.

5x5 Laplacian Matrix:

-4 -1 0 -1 -4

-1 2 3 2 -1

0 3 4 3 0

-1 2 3 2 -1

-4 -1 0 -1 -4

Or this may be more useful for copy and paste:

{

{-4,-1, 0,-1,-4},

{-1, 2, 3, 2,-1},

{ 0, 3, 4, 3, 0},

{-1, 2, 3, 2,-1},

{-4,-1, 0,-1,-4}

};

Video

There is a video of an example solution available on Canvas.

Mark distribution vs. time

The time taken to do each part is variable, and depends on your skills. The marks may or may not

represent the time you spend on each item. Gamma correction is easier than image resizing, but has

equal marks. This acknowledges start up time and encouragement to progress to something that

works to hand in.

Submission Requirements:

You will demonstrate your working program to me, or a post-graduate at times you will book using an

Eventbrite link I will send. These will be in the assignment advisory slots of 7th March and 14th March).

Submit your assignment through Canvas by the deadline at the top of this document. If you have

several files, place them in a ZIP). The coursework is worth 20% of this module. There is only 1

coursework. It is marked at the viva. You will get zero marks if you do not do the viva (even if you

submitted something on time). You will get zero marks if you do not make a submission (even if you

try to do the viva). You only get marks if you do both the on-time submission and the viva. If you

worked as a pair, you will only get marks if you both attend the viva.

Academic misconduct:

This is important. Each year a student will try to present code they don’t understand – don’t be that

student. A simple question like “Why did you do that” or “What does that do” should not stump you.

An assignment is not something to get through with minimal work. We aim to stretch you and give you

practise for your future academic work (e.g. third year project) and preparation for your future career.

Marking scheme

Note, if you cannot answer questions about your code (or have limited understanding of it), the

marks will be reduced (sometimes down to zero).

Understanding can be tested using questions like: How is this implemented, how are the other parts

implemented, what does this bit of code do? Appropriate marks will be deducted from each part if

the you cannot describe your own code. Just reading comments out is insufficient and marks should

be deducted. All in code comments must be in English.

1. Implement gamma correction [30 marks]

For each pixel the colour of the pixel is fetched, the gamma correction equation is applied to

each colour channel, and the colour is copied back to the pixel. The value for gamma correction

is obtained using a floating point slider. Values between 0.1 and 3.0 seem reasonable where 1.0

has no effect and could be the starting point. Values greater than 1.0 will make the image

brighter, and values less than 1.0 make it darker if implemented correctly. This can be seen from

the equation. It is OK if the code is the same as my example code for Gamma Correction. The

full 30 marks is for using the look up table approach.

2. Image resizing [30 marks]

Nearest neighbour interpolation is also presented in the coding video. You will probably have

a listener on the resizing slider that will call the resizing code with the desired image scaling

factor. In the resizing function, you will create an image of the correct new size. For each pixel

in the new image, work out where the pixel should be sampled from on the old image. This value

should be the floating point position. At this stage it would be good practice to call a function

that takes that sample position (as floats). The nearest neighbour sampling function will then

round down to the nearest integer and sample the image at that position (i.e., just get the colour

at that position). [15 marks]. Here is some advice for bilinear interpolation. You can choose to

follow it or do something else. A good approach would be to write the “lerp” function first that

takes two floating point values and the ratio between them, and returns the interpolated value.

Then write the bilinear function that carries out 3 lerps to find the correct sample value at a 2D

position. Both of these functions should be tested with known values to make sure they are

working. Then write a function that calls the bilinear function for each of the colour

components for the sample you wish to find. This can be called from the sampling function. [15

marks] (giving a total of 30 marks for part 2).

3. Cross correlation using Laplacian filter [40 marks]

A good approach will create the weighted sum function from the cross correlation definition

and pass in the filter to it. This can be called from a cross correlation function that will find the

weighted sum for each pixel and store it in the intermediate buffer. There will be a

normalisation function that will create an image that can be displayed from the intermediate

buffer.

Submission Procedure:

Submit the assignment through Canvas before the deadline. Demonstrate/viva your assignment

after the deadline at times to be notified.

The college policy for late submission will be used. The timestamp from Canvas will be used. I will

email students at their University account, so you must read this frequently during the term. You

might not be able to demonstrate/viva if you submit late.

If you have extenuating circumstances, follow the extenuating circumstances process. We will not

have a problem with making alternative arrangements for your viva if your EC period covers the viva.

But, if, as a result of extenuating circumstances, you get a one week extension, you must attend the

viva slots. The extension does not apply to the marking viva, only the submission date. You may

choose the later viva slot (14th March). If your EC applies to the whole period of submission and vivas

(e.g. 1st March to 15th March) we can make a special arrangement for the viva.

Individuals or pairs

If you do the assignment as a pair of students, please both submit the same code and indicate at the

head of the code that you worked as a pair and indicate the student number and name of both

students. Important: Make this clear at the viva.

To be clear, the same quality of solution submitted by a single student will get the same marks as the

same quality of solution submitted by a pair of students. There is no mark disadvantage for being in a

pair.

Both students in a pair will get the same marks unless you both agree that the marks should be

distributed differently. I don’t have a procedure yet for informing me of this because I presume this

would not happen, but if it does, then perhaps an email to me is best indicating the split. E.g., tell me

that one student gets 1.0 times the mark, and the other gets n times the mark where n<1. Then I will

multiply the full mark by n for the lower student, and the primary student gets the full mark.

FAQ

I’ve submitted the wrong version.

You can submit multiple times – I will mark the last version (submitted before the deadline).

Marks? (Marks are not feedback – see the next item).

Marks are provided at the demonstration/viva and very shortly after all vivas are complete in an

email to your University number email account. Therefore, it is possible for you to get marks within a

few days of the deadline if you select the earlier date.

Feedback: How does feedback improve my performance?

Feedback arises in several places within this course. Ahead of the submission you can show me and

teaching assistants your solution and ask us questions about it. This feedback is especially relevant

to improving your performance on the assignment. The feedback will directly increase your marks.

Obviously, post submission, the feedback will not improve your marks on the assignment. But it may

give you some ideas about areas you were stuck on which will help your future programming work on

other modules including the third year project.

Other feedback (separate from the assignment) includes you carrying out the practice course

examples and using the provided answers to self-evaluate. If you have difficulties, you can ask me to

cover the material in lecture and particularly the revision lecture.

Therefore, when it comes to questionnaires about feedback improving your performance, please

think about the feedback you can gain during the progress of the course and including selfevaluation against known answers, and not just the marks that are given once the assignment or

exam is over which will obviously have limited impact at that point to improve your performance.

Assignment Hints

I may add some hints to the assignment canvas web page in response to questions I get asked during

the first few weeks of term. The “Exercise Details” above gives some hints – e.g., 1. and part of 2., can

be done by watching the video and each other item gives some directions about how to do that part.

Also the marking scheme gives some more hints.

Changing the framework

Yes, you can change the framework. You can change the interface (hopefully to improve it). You can

use IDE’s to build an interface, so long as the key elements in the marking scheme are coded by you.

You can improve the interface and introduce more advanced features like contrast stretching, greyscale image, bicubic interpolation, etc. But none of this gets any marks in the above marking scheme.

Many students do this because they want their solution to be functionally better, to look nicer and

because they enjoy programming the assignment.

Existing libraries

A very few students use existing Java libraries to carry out image processing, like Gamma

Correction, image resizing and Convolution/Cross correlation Java Image libraries which all exist.

The whole point of the assignment is to program those functions yourself. If you use a library you will

get zero marks and I will draw your attention to this statement and the lectures where I mention this.

Suggested Schedule:

By 9/2/2024 Complete Gamma Correction question. This will include setting up your Java SDK,

JavaFX and IDE.

By 16/2/2024 Complete resizing question. Nearest neighbour is simply watching the video. The

bilinear will be where the real work starts.

By 23/2/2024 Cross correlation in progress. Aim to have tested code that can multiply the filter

weights against the pixels at a location and also create the intermediate array.

By 1/3/2024 Complete cross correlation and therefore complete the assignment, leaving the

weekend and Monday morning free for final polish, checks and submission.


相关文章

版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp