rem Program to scan laser photo for crosssection
rem to build 3D model
rem by Chuck Clancy Jan 2006
set display mode 640,480,32
cls 0
dim firstx#(7360)
dim firsty#(7360)
dim firstz#(100)
dim secondx#(7360)
dim secondy#(7360)
dim secondz#(100)
dim thirdx#(7360)
dim thirdy#(7360)
dim thirdz#(100)
dim pointsthissect(100)
rem ink rgb(0,0,255),1
maxred = 120
sectionbump = 1
firstbump=1
rem enter the base name only the count and extension will be added
input "base name of file ",infile$
input "number of frames to process ",numframes
rem load images loop loads all at once
for i=1 to numframes
fsq$ = str$(i)
snapshot$ = infile$ + fsq$ +".bmp"
load image snapshot$ , i ,1
next i
rem remove following file open after debug *****
open to write 1,"cltest.txt"
rem start image scan loop
for i = 1 to numframes
rem center image on page
paste image i,160,120
gosub getpoints
next i
rem open a text file to write the data
rem remove remark after debug open to write 1,"cltest.txt"
for i = 1 to numframes
counter2= pointsthissect(i)
for j=1 to counter2
remstart Remove this remark block after debugging ******************
tempx$ = str$(firstx#(j))
tempy$ = str$(firsty#(j))
write string 1, tempx$
remend
rem write string 1, tempy$
next j
rem write string 1, "-------------------------------------------------"
next i
remstart Remove this remark block after debugging ***************
for i = 1 to numframes
tempx$ = str$(pointsthissect(i))
write string 1, tempx$
next i
remend
close file 1
suspend for key
for ii = 1 to 17
delete image ii
next ii
undim firstx#(7360)
undim firsty#(7360)
undim firstz#(100)
undim secondx#(7360)
undim secondy#(7360)
undim secondz#(100)
undim thirdx#(7360)
undim thirdy#(7360)
undim thirdz#(100)
undim pointsthissect(100)
end
rem scan the image pixels for brightest red per line
rem within the area you specify with mouse clicks
getpoints:
show mouse
rem define topright and bottomleft with clicks
repeat
rodentx = mousex()
rodenty = mousey()
until mouseclick()
hix = rodentx
loy = rodenty
sleep 500
repeat
rodentx = mousex()
rodenty = mousey()
until mouseclick()
lox = rodentx
hiy = rodenty
sleep 200
rem get point location first occurance of highest red value
rem and stuff the coords in an array
for j = loy to hiy
for k = hix to lox
color=point(k,j)
redvalue=rgbr(color)
if redvalue > maxred then maxred=redvalue : myloc=k : myloc2=j
next k
rem if value greater than 120 put pixel coords in arrays
rem REMOVE FOLLOWING BLOCK AFTER DEBUG
roachkill$ = str$(color) + " ;"
roachkill$ = roachkill$ + str$(redvalue) +" ;"
roachkill$ = roachkill$ + str$(maxred)
write string 1, roachkill$
if maxred >120
firstx#(firstbump) = myloc * 1.0
firsty#(firstbump) = myloc2 * 1.0
firstbump = firstbump +1
maxred = 120
endif
next j
pointsthissect(sectionbump) = firstbump
sectionbump = sectionbump +1
return
Is his code... He posted it already right?
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.