How to mark specific points in a boundary?

조회 수: 3 (최근 30일)
Nayana R
Nayana R 2018년 10월 20일
댓글: Image Analyst 2020년 3월 7일
I used this code to mark boundary of my image.Now I want to detect specific points such as most concave point in a specific region of the boundary and most convex point.I have given the image that i detect the boundary and i manually detect the points using blue arrows that i want to mark automatically.Can you please suggest a method for this?
I = imread('055.bmp');
figure()
imshow(I);colormap gray
title('Original Image','fontsize',14);
img2 = imnoise(I,'salt & pepper',0.025);
I1 = img2;
for c = 1 : 3
I1(:, :, c) = medfilt2(img2(:, :, c), [5, 5]);%add median filter
end
x =rgb2gray(I1);
I2 = x < 60;
%I2 = im2bw(I1);
figure()
imshow(I2);colormap gray
title('Median Filtererd','fontsize',14)
dim = size(I2);
col = round(dim(2)/2)-90;
row = find(I2(:,col), 1 );
boundary = bwtraceboundary(I2,[row, col],'N');
%----Display original grayscale image and use coordinates returned by bwtraceboundary to plot the border on the image.
imshow(I);
hold on;
plot(boundary(:,2),boundary(:,1),'r','LineWidth',1);
BW_filled = imfill(I2,'holes');
boundaries = bwboundaries(BW_filled);
%------Plot the borders of the original grayscale image using the coordinates returned by bwboundaries-----------
for k=1:10
b = boundaries{k};
plot(b(:,2),b(:,1),'r','LineWidth',1);
end

답변 (2개)

Image Analyst
Image Analyst 2018년 10월 20일
  댓글 수: 1
Nayana R
Nayana R 2018년 10월 20일
Thank you for your reply Image Analyst.But I don't know how to run a function in MatLab as I am new to MatLab.I tried it.I can't understand what are arguments they are asking as (Vertices,Lines). Can you please explain a way to run this function if you can?
In my previous code above edges traced are not saving in the image.How can I save image with edges and apply this function to my own image?I hope you can help me.Thank you.

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


Jai Sri
Jai Sri 2020년 3월 6일
How to mark boundary of gray scale image in original color image?
  댓글 수: 1
Image Analyst
Image Analyst 2020년 3월 7일
This does not look like an answer to Nayana's question. If you have a question, post a new question and post both your gray scale image and your original color image.

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

Community Treasure Hunt

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

Start Hunting!

Translated by