Borrar filtros
Borrar filtros

How label a line plotted automatically on an image?

2 visualizaciones (últimos 30 días)
Sean
Sean el 22 de Feb. de 2015
Comentada: Sean el 23 de Feb. de 2015
Below is code Ive used to process a batch of images. The functions label white and dark regions on the image followed by plotting the necessary lines over the original data, identifying the segments. I'm looking to automatically label the plotted lines as 'Segment A' 'Segment B' etc, could anyone help me in doing so?
InputFolder = fullfile(pwd, 'FlatImages');
filePattern = fullfile(InputFolder, '*.bmp');
% Lists all BMP files in wd folder
BmpFiles = dir(filePattern);
OutputFolder = fullfile(pwd, 'SegmentedImages');
for i=1:length(BmpFiles)
fname = BmpFiles(i).name;
FullFileNameInput=fullfile(InputFolder, fname);
%Reads in each BMP file on by one
A=imread(FullFileNameInput);
[s f]=get_white_edges2(A);
[s1 f1]=get_Black_edges3(A);
Fname_out=['WE_' fname];
%Plots white and black edge segments on Flat Image
figure; imshow(A); hold on; plot([s f]); hold on; plot([s1 f1]);
FullFileNameOutput=fullfile(OutputFolder, Fname_out);
% -dbmp option with the PRINT command to save the
% figure as a BMP file. gcf returns current fig. handle.
print(gcf, '-dbmp', FullFileNameOutput);
end

Respuestas (1)

Image Analyst
Image Analyst el 22 de Feb. de 2015
Use the text() function.
  8 comentarios
Sean
Sean el 23 de Feb. de 2015
I'm initially looking to find the midpoint of the 2 lines of best fit, as I mentioned earlier the gap can vary between the beginning and end (size of area) of the white region or the row in which the white regions begin also varies. once mid points are calculated I was looking to label the 2 segments as Segment A and Segment B using the 'text' function.

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by