how can i connect between these squares in a line from the centers ????

조회 수: 2 (최근 30일)
ahmad dabbah
ahmad dabbah 2022년 11월 7일
댓글: Rik 2022년 11월 8일
  댓글 수: 3
David Hill
David Hill 2022년 11월 7일
Do you have the coordinates for the squares?
ahmad dabbah
ahmad dabbah 2022년 11월 8일
i dont have coordinates i have this pic and i have to connect between them its like a random coordinates

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

답변 (1개)

Marcel
Marcel 2022년 11월 8일
편집: Marcel 2022년 11월 8일
If you know the coordinates, width and height of each square, you can use the X and Y coordinates to get the top left corner of each square.
Now that you have the left corner, you add an "offset" to it, which would be half the height and width of the square to get the middle.
Then you can draw a line like this
% frame is something like you get from imread or getsnapshot
frame = insertShape(frame, 'Line', ...
[x1 y1 x2 y2], 'Color', "blue", "LineWidth", 4);
% X1 & y1 is the first square
% x2 & y2 is the second one
% by doing so you can connect them
  댓글 수: 2
ahmad dabbah
ahmad dabbah 2022년 11월 8일
i dont have coordinates i have this pic and i have to connect between them its like a random coordinates
Rik
Rik 2022년 11월 8일
You have an image, therefore you have coordinates. An image is nothing more than a list of intensity values layed out in a grid. You need to determine the location of the red pixels. Do you have any idea where to start with that?

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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by