L
L
Lilen122015-09-29 21:10:11
Delphi
Lilen12, 2015-09-29 21:10:11

How in Delphi can you recognize a straight line in the Image component, which is located at an arbitrary angle?

There is a drawing depicting a straight line at an angle, it is necessary to "recognize" this straight line and find the angle between the beginning of the straight line and the normal drawn to its beginning. Unfortunately, I have no thoughts on this matter, and I ask you to at least give links to literature on the relevant topic in order to understand. I would be very grateful for any information on this topic, I am sitting at an impasse ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2015-09-30
@AnnTHony

at least provide links to literature on the relevant topic

There is no such literature "Recognize a line and the angle of inclination of a line using Delphi", but there is a school geometry textbook.
And in the case:
- the Image component has a size: height and width
- to loop through all the pixels of this component and determine the color of each is also not a problem (I hope you don’t have to look for a black line on a black square?)
- when you find the coordinates of all pixels that differ in color from the Image background, select the extreme points from them - the ends of the segment (your line)
- now you can complete the triangle and calculate all the lengths of its sides
- in the geometry textbook find the algorithm for finding the angle of the triangle on two sides and implement it
- enjoy the work done!
142f1a581a8342e48f5d5c119a884733.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question