Image Segmentation using their magnitude and direction gradients
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 7 de Jun. de 2020
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
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!