PLEASE, if you do not know how to answer this, do not attempt to. Do NOT copy paste. Please do everything that is asked and do comment each line of code. Thank you!!
Replying to the comment: the data is not incomplete. I do have a sample image, but it cannot be posted here (3d party link), so you can search the internet for one.
Image Processing in MIPS Assembly - using MARS (mandatory) You MUST comment each line of code. Perform the following steps: (1) Read the disk file "image.pgm" containing a .pgm image. Search the internet for a sample.pgm 100x100 image file. The format PGM is saved in binary mode (P5 format). You will need to read from the disk a total of 100x100 (10,000 pixels, 1 byte per pixel in grayscale) +38 bytes for the image header = 10,038 bytes to be read. The image starts at +38 bytes from the beginning of the file (after the 4th byte with value 0Ah) This file must be read into memory using OS functions (SysCalls). (2) Generate the color histogram. In this case, because it is an image with shades of gray, generate the histogram counting the number of occurrences of each shade of gray. The image has a set of 10,000 pixels, where each pixel has a color tone, an intensity value ranging from Zero (pure black) to 255 (pure white), resulting in 256 shades of gray. The histogram counts how many times each value (between 0 and 255) occurs in the image, generating a vector of 256 values where each value represents the count of occurrences of that tone in the image. (3) Display the histogram values on the screen, in the following form:
: A list of 256 intensity occurrence value pairs will be displayed on the screen. For example: (0:50) (1:23) (2:290) (255: 1321) In this example, the hue value 0 occurs 50 times and the value 255 occurs 1321 times within the 10,000 pixels of the 100x100 image. (4) Ask the user to enter a threshold that will be used to binarize the image, i.e. transform the image into an image containing only black and white pixels. Pixels that have a value below the threshold entered should be converted to Zero (pure black) and pixels with values greater than or equal to the threshold should be converted to 255 (pure white). (5) Save the new image to disk with the name "processed.pgm", using exactly the same 38 bytes of the header at the beginning of the image, followed by the new image generated by the binarization process described by the previous step (4). Therefore, you must copy the SAME initial 38 bytes from the original read file, followed by 10,000 new bytes resulting from the binarization operation performed. PLEASE NOTE: PGM images can have different resolutions and different quantization levels (amount of tones), but here we will consider the PGM format type P5 with 256 tones (pixel values from 0 to 255) and always with a resolution of 100 x 100 pixels. You must search the internet for examples of binary PGM files containing 100x100. You must provide the ASM assembly language file created on MARS. You MUST comment each line of code. Image Processing in MIPS Assembly - using MARS (mandatory) You MUST comment each line of code. Perform the following steps: (1) Read the disk file "image.pgm" containing a .pgm image. Search the internet for a sample.pgm 100x100 image file. The format PGM is saved in binary mode (P5 format). You will need to read from the disk a total of 100x100 (10,000 pixels, 1 byte per pixel in grayscale) +38 bytes for the image header = 10,038 bytes to be read. The image starts at +38 bytes from the beginning of the file (after the 4th byte with value 0Ah) This file must be read into memory using OS functions (SysCalls). (2) Generate the color histogram. In this case, because it is an image with shades of gray, generate the histogram counting the number of occurrences of each shade of gray. The image has a set of 10,000 pixels, where each pixel has a color tone, an intensity value ranging from Zero (pure black) to 255 (pure white), resulting in 256 shades of gray. The histogram counts how many times each value (between 0 and 255) occurs in the image, generating a vector of 256 values where each value represents the count of occurrences of that tone in the image. (3) Display the histogram values on the screen, in the following form: : A list of 256 intensity occurrence value pairs will be displayed on the screen. For example: (0:50) (1:23) (2:290) (255: 1321) In this example, the hue value 0 occurs 50 times and the value 255 occurs 1321 times within the 10,000 pixels of the 100x100 image. (4) Ask the user to enter a threshold that will be used to binarize the image, i.e. transform the image into an image containing only black and white pixels. Pixels that have a value below the threshold entered should be converted to Zero (pure black) and pixels with values greater than or equal to the threshold should be converted to 255 (pure white). (5) Save the new image to disk with the name "processed.pgm", using exactly the same 38 bytes of the header at the beginning of the image, followed by the new image generated by the binarization process described by the previous step (4). Therefore, you must copy the SAME initial 38 bytes from the original read file, followed by 10,000 new bytes resulting from the binarization operation performed. PLEASE NOTE: PGM images can have different resolutions and different quantization levels (amount of tones), but here we will consider the PGM format type P5 with 256 tones (pixel values from 0 to 255) and always with a resolution of 100 x 100 pixels. You must search the internet for examples of binary PGM files containing 100x100. You must provide the ASM assembly language file created on MARS. You MUST comment each line of code