Second partial exam - RixFlores/Multiprocesadores GitHub Wiki
Parallel image processing applying grayscale filter, vertical axis reflection, and blur filter.
Variable declarations
Creation of the 10 input and output images, with timer start.
Sending each image in parallel to the filtro_bn method.
Final part of the Main, with second time capture, and total measurement from start to finish.
Initialization of the filtro_bn method with all the variables it uses, assignment of height and width for any image, in addition to the creation of 3 pointers using malloc that will serve us for processing at each stage, transformation to grayscale, image rotation and blurring filter, the advantage that dynamic memory management offers us is being able to have an easy handling of the variables within the allocated space, thus avoiding memory shifts or errors when processing images.
Image segmented in 4, of which each part is sent in parallel to the filtro_bn1 method to make the modifications to the images, the variable seccion_alto contains the equivalent of a quarter of the height of the original image, after this, within each section we send as parameters the lower limit and the upper limit, which will help each section identify the image fragment to process.
Close each image and release the pointers.
Initialization of the filtro_bn1 method, with the declaration of all the variables used to make the modifications to the images, this function is in charge of processing the image in the specified fragment.
For loop that converts our color image to grayscale.
For loop that reflects our image on the vertical axis.
End of filtro_bn1 method, and application of the “blurring” filter to our image.
Schedule
(All the code remains the same, except for the For loops, to change to grayscale, to reflect, and to apply the blur filter.) For loops look like this:
For cycle to convert our image to grayscale (With Schedule method)
For cycle to make the reflection of our image (With Schedule method)
For cycle to apply the blur filter to our image (With Schedule method)