필터 지우기
필터 지우기

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
Vijaya Lakshmi Chagi 2019년 3월 13일
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