






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
LAb Report of Artificial Intelligence
Typology: Study Guides, Projects, Research
1 / 10
This page cannot be seen from the preview
Don't miss anything!







Declare a numpy matrix(4x4) and use the built-in operators to slice the matrix and print its centre elements only. Flowchart:
Discussion: This task involves creating a NumPy array 'Array' representing a 4x4 matrix of integers. Array slicing is used to extract a subarray 'Center_Elements' consisting of elements from rows 1 to 2 and columns 1 to 2. The ' Center_Elements ' array contains the central 2x portion of the original 'Array' matrix. This task demonstrates the use of NumPy for array manipulation and slicing.
Read a black and white image from the directory, and then slice it using the matrix slice operators and display the sliced Image.
This task involves matrix addition using NumPy. Two NumPy arrays 'A' and 'B' are created, representing 4x4 matrices of integers. An empty result matrix is initialized, and nested loops are used to add corresponding elements of 'A' and 'B', storing the result in the 'C' matrix. This task showcases basic matrix operations with NumPy.
In this task we load an image ('lab2.jpeg'), initially displaying it in grayscale using Matplotlib. Subsequently, it iterates through the image's pixels, swapping black (pixel value
In these tasks, we harnessed Python's prowess, relying on essential libraries like NumPy for array operations and Matplotlib for image processing. Task 1 demonstrated NumPy's efficiency in array manipulation and slicing, while Task 2 showcased seamless NumPy- Matplotlib integration for precise image handling and extraction. Task 3 highlighted NumPy's computational efficiency in matrix operations, exemplified through simple matrix addition. Task 4 showcased the combined power of Matplotlib and NumPy in a fundamental yet effective image processing technique – color inversion. Python's versatility in data manipulation, matrix operations, and image processing shines through these tasks, making it an indispensable tool for various scientific endeavors. ----------------------------------------------------------------------------------------------------------------