Image Segmentation using their magnitude and direction gradients
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello all, i have attacthed magnitude and direction gradients of 3 images. I am trying to achieve a segmentation where the section below the red curve is removed and the section above the red curve should be preserved. I have shown below for image 2:

I have attatched what i want to acheive for image 1 and image 3 as Image-1 and image-3. I used paint to highlight the red curve. Can you guys suggest me some ways to acheive this? Any help is appreciated and thankyou in advance. The code i used is below
clc;
clear;
close all;
a=imread(filename);
B = imgaussfilt(a,1.4);
[Gmag,Gdir]=imgradient(B,'prewitt');
figure;
imshowpair(Gmag,Gdir,'montage');
I have also attacthed the original images as org1, org2 and org3.
댓글 수: 0
답변 (1개)
Image Analyst
2020년 6월 7일
Just threshold the image and use find() to find the last row in each column where the signal is above the threshold.
thresholdValue = 10; % Whatever works
[rows, columns, numberOfColorChannels] = size(grayImage);
lastRows = zeros(1, columns);
for col = 1 : columns
r = find(grayImage(:, col) > threshold, 1, 'last')
if ~isempty(r)
lastRows(col) = r;
end
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!