Log in

View Full Version : Help with DTMs



Light
02-16-2010, 09:06 PM
Edit: SOLVED

I was wondering how DTMs work.

I've looked at Yohojo's tutorial:

A DTM i a special point on the screen that SCAR recognizes by how far it is from certain points and colors

As well as Dusk412's:

A DTM will use one main point (or the parent) and several subpoints (sometimes called the children). The script will then look in the area you specify for this point (the main point) in relation to its distance from other points (the subpoints). It finds these points using their color.


Even the SRL wiki:

Basically they compare colors, and depending on what colors are found and how far away from each other they are

But I'm not content. I'd be interested in learning more detail about how they work. Is there anyway I could find the source code for FindDTM? Do you guys have any suggestions on how I would go about learning more detail?

I'd like to get to the point of being able to write my own DTM function. (Just to learn it, not that I want to reinvent the wheel here)

Thanks,
Light

Bionicle
02-16-2010, 09:28 PM
Open SCAR --> Tools --> DTM Editor

Take a print screen of the item you want to make a DTM of, and go to the DTM Editor, click File --> Paste Image
Click on the main color of the item, and it will save the color in the box in the top righthand side of the screen. Then proceed to click the outer edge of the item, on the black line. Click four or five different points on the outline, then change the tolerance to about 15-20, go File --> DTM To Text, close the window, and your DTM will be in the debug box :)
Set the name of the DTM as an integer, replace the name DTM in the text to the name of your DTM, and paste the text at the beginning of your procedure. Then procced to use the DTM functions through your script :).
DONT FORGET TO FREE YOUR DTMS!
FreeDTM(DTM);
Hope this helps, i threw it together kind of fast, just point out anything that doesn't make since and i'll explain further

Frement
02-16-2010, 09:31 PM
Open SCAR --> Tools --> DTM Editor

Take a print screen of the item you want to make a DTM of, and go to the DTM Editor, click File --> Paste Image
Click on the main color of the item, and it will save the color in the box in the top righthand side of the screen. Then proceed to click the outer edge of the item, on the black line. Click four or five different points on the outline, then change the tolerance to about 15-20, go File --> DTM To Text, close the window, and your DTM will be in the debug box :)
Set the name of the DTM as an integer, replace the name DTM in the text to the name of your DTM, and paste the text at the beginning of your procedure. Then procced to use the DTM functions through your script :).
DONT FORGET TO FREE YOUR DTMS!
FreeDTM(DTM);
Hope this helps, i threw it together kind of fast, just point out anything that doesn't make since and i'll explain further

He asked how it works :) You only told him how to use them.
And im putting up a picture and stuff. I hope i can explain it good.

Bionicle
02-16-2010, 09:32 PM
He asked how it works :) You only told him how to use them.
And im putting up a picture and stuff. I hope i can explain it good.

Oh :duh:.

Frement
02-16-2010, 09:35 PM
http://www.frement.net/srl/DTM.png

Usually in the DTM editor, the first point you create is the point of origin. Every other point is compared to that.

The DTM function the first pixel that matches the point of origin (Point 1) and then searches for the next pixel in the DTM which is in my graph the Point 2, now that is 3 pixels away from Point 1, so it will search from (5,2) and if that color matches it will go to Point 3, and if that matches also, to Point 4, if it fails to find the colors in some point, it will break the loop and go to next pixel that matches point of origin (Point 1). (Someone please correct me if im wrong).

E: Also in DTM editor you can click an existing point to change the next points Point of origin. I'll create a graph if you like. Just ask :)

Ask if you have any further questions.

Light
02-16-2010, 09:36 PM
Thanks Frement. Yes, I'd like to learn exactly how they work. There's plenty of tuts out there on how to use them. Thanks for the response though bionicle.

Again, the main goal is: I'd like to get to the point of being able to write my own DTM function. From creating a dtm to looking at the data to be able to find one.

Edit: I read Frement's post. It was helpful. Does our DTM finder (with tolerance) make tolerances for the points or just for the colors?

Frement
02-16-2010, 09:44 PM
Thanks Frement. Yes, I'd like to learn exactly how they work. There's plenty of tuts out there on how to use them. Thanks for the response though bionicle.

Again, the main goal is: I'd like to get to the point of being able to write my own DTM function. From creating a dtm to looking at the data to be able to find one.

Edit: I read Frement's post. It was helpful. Does our DTM finder (with tolerance) make tolerances for the points or just for the colors?

Just the color, althought there is "Area size" option also, that increases the search area of each pixel, which gives tolerance to the pixels locations.

E:
http://www.frement.net/srl/DTM2.png

There i made an example DTM, and the graph represents how it goes.

Again the Point 1 is the point of origin, and Point 2 is compared to that, but now what i did, i clicked the Point 2 in DTM editor (Top right corner. See Image 2.) and used it as a point of origin for the next point (Point 3), and did the same thing for Point 4. Now it compares the Point 2 to Point 1 and Point 3 to Point 2 and so on.

Image 2:
http://www.frement.net/srl/DTME.png

E2: Now you can ask anything that i did not cover and you wish to know and i'll explain it as good as i can. But now im afraid i have to sleep some. Have to wake up for work.

Light
02-17-2010, 01:59 AM
Thanks, that's what I wanted to know. You've been very helpful :)