hello, thanks for reading this complex question, we need to use c(pelles c)to write this program, and after phase 1 and step 1 and 2 in phase 2. i want to know how to write a subfunction for function"Add" thanks a lot for helping
In this project, students need to finish a program that can recognize an image with handwriting digit, for example, The image is stored in a file. To recognize the image, the image information in the file must be read and stored in a two-dimensional array (matrix), and a certain algorithm is used to calculate the similarity of the handwriting digit to 10 digits from 0 to 9 . The digit with highest similarity will be the output. For example, Figure 1 From Image to array, then from array to digit In this project, students can finish Phase I and Phase II as described below to finish the recognition of a handwriting digit. Phase I: From image file to matrix Input: A file that stores an image with 2828 pixels. Each pixel can be represented as an integer between 0 and 255 (inclusive). Output: Matrix A (2828), Steps from the file to the matrix: 1. Declare an array float A[28][28]. 2. Use the fgets function to skip the first four lines in the file, which are some basic information about this image. 3. Use fgetc function repeatedly to read each pixel from the fifth line until 784 chars have been obtained. Store these chars in the 2828 array. 4. Normalize each pixel value by dividing 255.0 and store into array (Matrix A). Matrix A will be used in Phase II. pixel=fgetc(fp);pixel=pixel/255.0 Example: 'hase I Figure 2 Phase I. From image to array- Phase II: From Matrix A to digit output 1. Reshape Input: Matrix A (2828) from Phase I. Output: Matrix B ( 1784 array). Reshape: B[m28+n]=A[m][n]. Example: 2. Multiply (first time) Input: Matrix B ( 1784 array from reshape step) Matrix C (784128 array from file W1.txt) Output: Matrix D. Multiplication: Matrix D is the multiplication of Matrix B and Matrix C. Multiplication rule of arrays: c11=a11bn1+anb3n+anbn+anbnn244323 F[m][n]=D[m][n]+E[m][n] In this project, students need to finish a program that can recognize an image with handwriting digit, for example, The image is stored in a file. To recognize the image, the image information in the file must be read and stored in a two-dimensional array (matrix), and a certain algorithm is used to calculate the similarity of the handwriting digit to 10 digits from 0 to 9 . The digit with highest similarity will be the output. For example, Figure 1 From Image to array, then from array to digit In this project, students can finish Phase I and Phase II as described below to finish the recognition of a handwriting digit. Phase I: From image file to matrix Input: A file that stores an image with 2828 pixels. Each pixel can be represented as an integer between 0 and 255 (inclusive). Output: Matrix A (2828), Steps from the file to the matrix: 1. Declare an array float A[28][28]. 2. Use the fgets function to skip the first four lines in the file, which are some basic information about this image. 3. Use fgetc function repeatedly to read each pixel from the fifth line until 784 chars have been obtained. Store these chars in the 2828 array. 4. Normalize each pixel value by dividing 255.0 and store into array (Matrix A). Matrix A will be used in Phase II. pixel=fgetc(fp);pixel=pixel/255.0 Example: 'hase I Figure 2 Phase I. From image to array- Phase II: From Matrix A to digit output 1. Reshape Input: Matrix A (2828) from Phase I. Output: Matrix B ( 1784 array). Reshape: B[m28+n]=A[m][n]. Example: 2. Multiply (first time) Input: Matrix B ( 1784 array from reshape step) Matrix C (784128 array from file W1.txt) Output: Matrix D. Multiplication: Matrix D is the multiplication of Matrix B and Matrix C. Multiplication rule of arrays: c11=a11bn1+anb3n+anbn+anbnn244323 F[m][n]=D[m][n]+E[m][n]