MATLAB Answers

0

Draw a matrix image of blood vessel

Asked by Kingsley Choong on 29 Oct 2019
Latest activity Answered by darova
on 29 Oct 2019
I would like to create an matrix image for the blood vessel with different pixel value for the blood vessel by the code below that i tried. First, i create an image with all 0 pixels then i would like to add a specific value to the coordinates of the image but i end up with the whole line of the position with the specific value. Any suggestion or code like drawing a curve line by matrix can i do for this work? thank you for the help.
row = 255;
col = 255;
img = zeros(row, col);
img(50:105, :) = 0.2;
img(:, 100:105) = 0.5;
figure;
imshow(img);

  0 Comments

Sign in to comment.

1 Answer

Answer by darova
on 29 Oct 2019
 Accepted Answer

Would it be helpfull?
n = 10;
dt = .1;
[x, y, z] = deal( zeros(2,10) );
axis([-1 1 -1 1]*10)
hold on
k = 0;
t = 360*(rand(1,n)-1);
for i = 1:100
t = t + 50*(rand(1,n)-0.5);
x(1,:) = x(2,:);
y(1,:) = y(2,:);
x(2,:) = x(2,:) + dt*cosd(t);
y(2,:) = y(2,:) + dt*sind(t);
k = k + 1;
pause(0.1)
plot(x,y)
end
hold off

  0 Comments

Sign in to comment.