# How to get Local maximum determination of an image

6 views (last 30 days)
pizzaa on 27 Jun 2023
Answered: Aniketh on 6 Jul 2023
Hi guys i have these image
How do i convert these image into data like thse
I read the paper it says "In this block of the method, GLPM vector has been obtained and local maximum peaks of the vectors has been extracted, subsequently. Therefore, the GLPM is applied first to the derotated image to determine the fabric yarn density which is the number of warp or weft yarn of the fabric per unit length. The number of yarns per unit length is found to be the number of local peaks of the gray line profile of the derotated image"
How to achive this? ty so much

Aniketh on 6 Jul 2023
Hi,
I was able to get similar results on this image
To determine the local maximum peaks in an image, you can use MATLAB's built-in functions and techniques. Here's a general approach to achieve this:
1. Read and preprocess the image: Start by reading the image and applying any necessary preprocessing steps, such as converting to grayscale or enhancing the contrast.
2. Obtain the gray line profile: Extract a line profile from the image along a specific direction (e.g., horizontal or vertical). This can be done by selecting a row or column of pixels from the image.
3. Smooth the line profile: Apply a smoothing filter to the line profile to reduce noise and enhance the prominence of local peaks. You can use techniques like averaging or Gaussian smoothing.
4. Find local maximum peaks: Use MATLAB's findpeaks function to detect the local maximum peaks in the smoothed line profile. This function identifies peaks that are higher than their neighboring points within a specified distance.
Here's an example code snippet that demonstrates this process:
% Read and preprocess the image
grayImage = rgb2gray(image);
% Extract the line profile (e.g., along a row)
lineProfile = grayImage(100, :); % Extract line profile from row 100
% Smooth the line profile
smoothedProfile = smoothdata(lineProfile, 'gaussian', 10); % Gaussian smoothing with a standard deviation of 10
% Find local maximum peaks
[pks, locs] = findpeaks(smoothedProfile);
% Plot the line profile with local maximum peaks
figure;
plot(lineProfile);
hold on;
plot(locs, pks, 'ro', 'MarkerSize', 10);
hold off;
title('Line Profile with Local Maximum Peaks');
xlabel('Pixel Index');
ylabel('Intensity');