The goal of this assignment is for you to get an intuition for the kind of raw data is produced by a camera sensor before it is turned into an image. To do so, I’ll be handing to you the kind of analog signal a camera would produce, for you to play around with. The assignment is open-ended, and you are free to choose how you wish to go about solving it - I’ll mention 3 or 4 different ways at the end here.
So in this assignment you will be given 3 text files, each with a list of numbers in them - which represent the voltage produced at each pixel location for a CMOS sensor while taking a particular picture. The _easy.txt and the _medium.txt files represent a 256 by 256 image, while the _hard.txt represents a 512 by 512 pixel image. So a list of (256 256) voltage values for the _easy.txt and _medium.txt files, and (512 512) values for the _hard.txt file.
Each of those “pictures” contain one of three objects - a ball, brick, or cylinder, like so –
You are tasked with using what you’ve learnt about how different intensities producing different sort of voltage values, to try and write a program that would visualise the “signal” in the file you are given enough to be able to guess at what the object in your “image” is.
In the files section, you will find an assignment_1_files.zip which will have a bunch of text files. The one’s meant for you will start with your NinerNet username. If your username is ddhamani, look for ddhamani_easy.txt, ddhamani_medium.txt, and dhamani_hard.txt
A couple of notes –
- To make things easier for you, the pictures are grayscale, meaning that each voltage value for each pixel co-relates with the intensity of gray color at that pixel.
- Each student is assigned a random image - please don’t think that your friends’ _easy.txt file has a brick in it so yours’ will too. I wrote a script to randomly assign each student a random file.
- The easy images only have the object somewhere within them, the medium and hard ones may or may not have additional background objects.
- Since I am not really giving you guys a whole lot of instruction on how to go about doing this - the idea is to try and get you to think for yourself - this assignment is only worth 30 points, which is about a third of what an assignment is usually worth.
- You will not be graded on whether or not you were able to figure out what was inside the _hard.txt file. However if you do manage to do so, you will get some extra credit. Detailed rubric will be included.
- If you feel lost, feel free to ask for a hint on Zulip and one of your classmates will help you out. If quite a lot of people feel lost, one of the instructors will step in with a hint.
- We know from the first lecture that a camera sensor for the most part is just a grid of individual pixel sensors.
- Each “pixel sensor” is a tiny photodiode that turns any incident photons on the photodiode into electric potential.
- This electric potential is read out by circuitry as described in the previous lecture, and eventually handed over to the analog front end, and eventually gets turned into an image.
- The assignment given sort of butts into this process and gives you the analog signal produced, for you to play around with, and guess what object is in your “image”.
- To do this, we would require different voltages to “look” different in order for us to visually determine what was inside the image.
- In previous semester, some students wrote code to generate text art (ascii art) from these voltages and successfully identified the object within.
- Some used conditional formatting found in spreadsheet software (like Excel) had tools that helped assign a different color to different range of numbers, which also led to successful identification of the object within. (To do this, they first converted the list to a CSV file, and then openned them in Excel)
- Another random way we can go about doing the same –
- Write code to read the list of values you were given in your _easy.txt, _medium.txt, and __hard.txt files.
- Try to assign color to 2-4 range of values. For example 0.2-0.8 is light-gray, 0.8 and above is black. As many ranges as you feel appropriate.
- Replace each voltage value in the list, with an string containing HTML span of the color for that interval, with a single character inside, for example - 0.246642 according to the above would be
<span style="color:gray"]@[/span>. Various gray colors as understood by HTML can be found here.
- You will now have a list of strings
- Based on this list, write out an HTML document. Do know that you would have to add a [br] tag to insert a new line at the end of every “row” for the image - after every 256 spans for the easy and medium files, and 512 spans for the hard file.
- Opening this HTML document in a webpage should let you identify what object is inside, after zooming out.
- I have not done this and tried it out myself, so maybe it won’t work out all that well. Worth a shot though.
The submission for this assignment is a single text file - preferably a markdown document - answering the following questions –
- What object was inside your _easy.txt file? (ball, brick, or cylinder) Attach a screenshot of your visualization, and any code you wrote to do the same. [30 points]
- What object was inside your _medium.txt file? (ball, brick, or cylinder) Attach a screenshot of your visualization, and any code you wrote to do the same. [20 points]
- What object was inside your _hard.txt file? (ball, brick, or cylinder) Attach a screenshot of your visualization, and any code you wrote to do the same. It is unlikely any of the aforementioned methods would let you guess at what object was in there, to attempt this question you’d hopefully will need to do a little research. [10 extra credits]
Thank you, and do not hesitate to ask for help