Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 The task A museum is developing a virtual reality (VR) reconstruction of a region of London, showing how it appeared in about 1900 -
1 The task A museum is developing a virtual reality (VR) reconstruction of a region of London, showing how it appeared in about 1900 - see Figure 1 . They want visitors to be able to place a pointer on a map of London and use the position and orientation of the pointer to determine the location and direction of the view in the reconstruction, as shown in Figure 2. You might be interested to learn that this reconstruction can be experienced in my research lab, which has a whole-wall (4.22.5m) stereoscopic display, using interaction modalities that include gestures and a bicycle! Figure 1: VR reconstruction of Paternoster Row in London The map to be used is Horwood's hand-drawn one from about 1792. It is actually two of his maps joined together; pretty accurate for something hand-drawn that long ago. Figure 2: Horwood's map with blue background and red pointer; the view in Figure 1 corresponds to the location and direction of the pointer In the museum, a camera is arranged above a dark blue table, looking directly downwards. The idea is that visitors put their copy of Horwood's map roughly in the middle of the table and then place the red pointer on it. The people who are developing the exhibit clearly designed things with care to make the computer vision task easier: the lighting illuminates the table fairly uniformly, the light-coloured paper on which the map is printed is a good contrast to the dark background and the red pointer is a very different colour from the paper. The map has a green arrow showing the direction of north. The tip of the red pointer determines the viewpoint and the direction in which it is pointing determines the view direction; you have to print these out from your solution as detailed in Section 2. The general approach to the assignment should be fairly clear: 1. Segment the map from the blue background in the original image and extract it into a separate image in a way that makes the map edges match those of the extracted image. 2. Locate the green arrow and if it is not top-right of the map, rotate it through 180 degrees. 3. Segment the red pointer. 4. Locate the tip of the pointer to determine the location. 5. Determine the orientation of the pointer, convert it to a bearing and output it. My own solution is about 150 lines of commented Python code and took about half a day to develop. Of course, I know OpenCV pretty well and knew from experience almost exactly how the program needed to work. You will take longer to develop your own solution. All of the computer vision parts of the assignment are done using OpenCV calls so the program's runtime is well under a second. You should be able to make a start to the assignment as soon as you have done the first couple of laboratory experiments, and be able to do pretty much all of it after experiment 3 . To do one step of the overall task, it might help if you review the chapter on Vision in a 3D world in the lecture notes. 3 rigure s: the courunate system tor the map 2 Operation and evaluation Your solution should be written in Python. You are free to use OpenCV and/or numpy functionality in your solution, which must run on CSEE's Horizon server under Linux or in CSEE's Software Labs, also under Linux. You should not use any modules that are not already installed on these systems. Your program must accept precisely one argument from the command line, the name of the image to be processed, as in: python3 mapreader.py develop/develop-001.png It should output two lines in the following format: POSITION 0.6730.212 BEARING 316.4 Any other output it generates is ignored. Your submitted program must not display any images. A template version of mapreader . py is supplied, which does nothing more than handle the command line and print output in the required format; you are advised to use this as a starting point for your own solution. When the map is oriented correctly with north pointing upwards, the two numbers following POSITION represent the location of the point of the red pointer, being respectively the distance along the bottom of the map and the distance up its side, with the origin at the bottom left-hand (south west) corner. These numbers should both be in the range 01, as illustrated in Figure 3 . The number following BEARING should be the angle in which the red pointer is pointing, given in degrees measured clockwise from north. In accordance with good testing in computer vision, the imagery I shall test your program with is different from that you are using to develop it. It does however have identical characteristics, so if your program works on the supplied imagery it should also work on my unseen test imagery. The reason for being so prescriptive about the way your program is executed and the appearance of its output is because its functionality will be checked using a test harness, a piece of software that runs it and analyses its output. You will lose marks if your submission doesn't work with the harness. There is nothing secret about the test harness, it is included as part of the assignment's zip file. You run it as follows: python3 harness.py If your program is called anything other than mapreader.py, you have to give its name on the command line when you run harness. py. 3 Incorporating others' work Almost everyone looks for inspiration when writing software: a web search is very quick and easy to do and can often help with something that has you stumped. This is absolutely fine and you are encouraged to do it - but do be careful how you use the information you find to avoid being accused of cheating. This is perhaps best illustrated by an example. Let's say you cannot remember how to work out the roots of the quadratic ax2+bx+c=0 and you do a web search for: python roots of a quadratic equation One of the top links gives you the two lines of Python you need. If you incorporate this directly into your code, you must acknowledge the source as shown below: \# The following two lines are taken from # https://www.w3resource.com/python-exercises/math/python-math-exercise-30.php x1=(((b)+sqrt(r))/(2a)) x2=(((b)sqrt(r))/(2a)) Studying the code you might see that, at least in Python 2, this could give the wrong answer if a, b and c were all integers; and there are far too many parentheses. If you take that code but correct it and change it to fit into your algorithm, you should write in your program: \# The following two lines are adapted from # https://www. w3resource.com/python-exercises/math/python-math-exercise-30.php x1=(b+ math.sqrt (r))/2.0/a x2=(b+ math.sqrt (r))/2.0/a You don't lose any credit for doing so. Another way to solve problems is to talk about them with your friends. Feel free to do this while thinking about algorithms and approaches... but stop when you reach the point of talking about code. To continue the above example, you might say to your friend that you need to intersect a line with a circle in your program. Your friend may then explain how the problem turns out to be a quadratic equation, a term you remember vaguely only from school. This is fine... but if she gives you code to put into your program, you are both guilty of cheating. (Incidentally, this equation is a remarkably poor numerical solution to a quadratic equation.) Be warned that I am pretty rigorous in checking for both kinds of cheating, using a combination of tools such as turnitin and some of my own and identifying chunks of code in submissions that look similar as I work through them. In general, you lose no marks by incorporating modest amounts of external code (when done correctly), so cheating is a really, really stupid thing to do. People found guilty of cheating may well receive a mark of zero for the assignment - just think what that would do to your overall module mark
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