# How to automatically detect the patterns in the plot?

조회 수: 14 (최근 30일)
MP 2022년 7월 29일
댓글: Walter Roberson 2022년 8월 3일
Is it possible to make a matlab code that can automatically detect the patterns in the plot?
In the plot attached below, we can see some sharp protruding features (indicated by red lines). I would like to generate the MATLAB code to detect the X, Y and Z values of these features. These are dispersive patterns. I have 1000's of images and would like to automate the program to obtain the detect these features in each plot.
Any help will be greatly appriciated.

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Image Analyst 2022년 7월 29일
I'd scan down the image using bwareafilt to get the largest stretch of white in each line. Then record the endpoints. Then use findpeaks to find the peaks (where you put your red lines.) Here's a start, assuming your data is a matrix and the value of the white region is 255.
binaryImage = grayImage == 255;
% Extract two largest blobs only.
binaryImage = bwareafilt(binaryImage, 2);
imshow(binaryImage);
[rows, columns] = size(binaryImage)
leftEdges = nan(rows, 1);
rightEdges = nan(rows, 1);
for row = 1 : rows
thisRow = binaryImage(row, :);
% Get the largest white blob.
biggestBlob = bwareafilt(thisRow, 1);
% Find the left edge
leftEdges(row) = find(biggestBlob, 1, 'first') - 1;
% Find the right edge
rightEdges(row) = find(biggestBlob, 1, 'last') + 1;
end
% Find peaks
[leftPeaks, leftIndexes] = findpeaks(leftEdges);
% Find right peaks - need to invert the signal so we actually find the
% valleys, which are peaks pointing to the left.
[rightPeaks, rightIndexes] = findpeaks(-rightEdges);
rightPeaks = -rightPeaks;
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
MP 2022년 8월 1일
I am sorry but I do not have image processing toolbox!
Walter Roberson 2022년 8월 3일
If you need to do image processing work, you really should get Image Processing Toolbox.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Image Category Classification에 대해 자세히 알아보기

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by