how to create 1 in zeros matrix, in order to convert oblique line, which's plotted in x and y coordinates

1 次查看(过去 30 天)
I have a line, which's rotated in random angle, but I want this line in an image (0-1) that's why I scaled the points (Leiter) in x and y coordinates in this way:
Line =
0.0418 0.0599 0
0.0417 0.0578 0
0.0415 0.0557 0
0.0413 0.0536 0
0.0411 0.0515 0
0.0409 0.0494 0
0.0407 0.0473 0
0.0405 0.0452 0
0.0403 0.0431 0
0.0401 0.0410 0
0.0399 0.0390 0
0.0397 0.0369 0
0.0395 0.0348 0
0.0393 0.0327 0
0.0391 0.0306 0
0.0389 0.0285 0
0.0387 0.0264 0
0.0385 0.0243 0
0.0383 0.0222 0
0.0382 0.0201 0
x_image = round(((((Line(:,1)*100)-1)*(100-1)/(7-1))+1));
y_image = round(((((Line(:,2)*100)-1)*(100-1)/(7-1))+1));
im = zeros(100);
for i = 1:20
im((y_image(i,1)),(x_image(i,1)))=1;
end
but I don't have a line not anymore, but points
could someone help me?

回答(1 个)

Vijaya Lakshmi Chagi
Hi Osama,
You can try using the interp1 fucntion rather than rounding off the values. This fucntion interpolates the points based on the query points(sampling over the range of x)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by