필터 지우기
필터 지우기

Image Segmentation using their magnitude and direction gradients

조회 수: 5 (최근 30일)
Apoorva Maiya
Apoorva Maiya 2020년 6월 7일
댓글: Apoorva Maiya 2020년 6월 9일
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.

답변 (1개)

Image Analyst
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
  댓글 수: 1
Apoorva Maiya
Apoorva Maiya 2020년 6월 9일
Thank you for your help but this methos doesnt seem to work since some rows are empty. Is there anything we could do with the direction gradient because it shows a sharp ridge at whare I want to segment the image.

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by