- Read the Set of Images: Load each image in the set into the workspace.
- Identify Minimum Points: For each image, find the minimum intensity value and its corresponding pixel location.
- Store Minimum Points: Keep track of these minimum points, ideally in an array or list.
- Calculate Average Minimum Points: Once all minimum points are collected, calculate the average location.
- Plot the Points: Plot these average minimum points on a graph, using the pixel coordinates as the x and y axes.
img = imread(sprintf('image%d.png', i));
[min_val, linear_idx] = min(img(:));
[row, col] = ind2sub(size(img), linear_idx);
min_points_x = [min_points_x; col-1];
min_points_y = [min_points_y; row-1];
avg_min_point_x = mean(min_points_x);
avg_min_point_y = mean(min_points_y);
plot(avg_min_point_x, avg_min_point_y, 'ro');
title('Average Minimum Intensity Points');
In this script:
- N is the number of images.
- sprintf('image%d.png', i) should be replaced with the actual pattern of image filenames.
- The loop reads each image, finds the minimum value and its position, and stores it.
- After the loop, the average of the minimum point locations is calculated.
- The average point is plotted in red on a graph.
Please note that the imread function assumes that the images are in the current working directory and are named in a sequential pattern like 'image1.png', 'image2.png', etc. You'll need to adjust the file reading part to match your actual image file names and paths.
If the images are not named sequentially or are in different formats, you'll need to adapt the code accordingly.
If you liked the anwer and it solved your problem. Please do leave a upvote and a comment means a lot. Thank you.