Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your function should replace the value of each pixel in the grayscale image with the maximum possible value (0xFF, i.e. brightest value), if the intensity

image text in transcribed

Your function should replace the value of each pixel in the grayscale image with the maximum possible value (0xFF, i.e. brightest value), if the intensity (value) of that pixel is greater than or equal to some constant T (function input), or otherwise with the minimum value (0x00, i.e. darkest value). Remember that these values are unsigned.

############################################################### # Text Section .text # Utility function to print byte arrays #a0: array #a1: length print_array: li $t1, 0 move $t2, $a0 print: lb $a0, ($t2) andi $a0, $a0, 0xff li $v0, 1 syscall li $v0, 4 la $a0, space syscall addi $t2, $t2, 1 addi $t1, $t1, 1 blt $t1, $a1, print jr $ra ######################################################################################## #a0 = input array #a1 = output array #a2 = matrix #s3 = input dim #s4 = test str #s5 = expected array # Test transform function ######################################################################################## test_p2: # save ra addi $sp, $sp, -4 sw $ra, 0($sp)

addi $sp, $sp, -4 sw $a0, 0($sp) addi $sp, $sp, -4 sw $a1, 0($sp) addi $sp, $sp, -4 sw $a2, 0($sp) addi $sp, $sp, -4 sw $a3, 0($sp) addi $sp, $sp, -4 sw $s4, 0($sp) addi $sp, $sp, -4 sw $s5, 0($sp)

#a0: input buffer address #a1: output buffer address #a2: transform matrix address #a3: image dimension (Image will be square sized, i.e. total size = a3*a3) jal transform

lw $s5, 0($sp) addi $sp, $sp, 4 lw $s4, 0($sp) addi $sp, $sp, 4 lw $s3, 0($sp) addi $sp, $sp, 4 lw $s2, 0($sp) addi $sp, $sp, 4 lw $s1, 0($sp) addi $sp, $sp, 4 lw $s0, 0($sp) addi $sp, $sp, 4

# s5: exp arraay # s4: input string # s3: input dimenstion # s2: matrix # s1: user out # s0: inputd

mul $s3, $s3, $s3

move $a0, $s4 syscall la $a0, i_str syscall move $a0, $s0 move $a1, $s3 jal print_array li $v0, 4 la $a0, new_line syscall

la $a0, po_str syscall move $a0, $s1 move $a1, $s3 jal print_array li $v0, 4 la $a0, new_line syscall la $a0, eo_str syscall move $a0, $s5 move $a1, $s3 jal print_array li $v0, 4 la $a0, new_line syscall syscall

# restore ra lw $ra, 0($sp) addi $sp, $sp, 4

jr $ra

############################################################### ############################################################### # PART 1 (Image Thresholding) #a0: input buffer address #a1: output buffer address #a2: image dimension (Image will be square sized, i.e., number of pixels = a3*a3) #a3: threshold value ############################################################### threshold: ############################## Part 1: your code begins here ### ############################## Part 1: your code ends here ### jr $ra ###############################################################

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

Create a Fishbone diagram with the problem being coal "mine safety

Answered: 1 week ago

Question

1. Outline the listening process and styles of listening

Answered: 1 week ago

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago