Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Hmmmm What is wrong here?

Author
Message
mohawk
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United States
Posted: 9th Jan 2006 03:52
Hi all
I'm getting older and obviously the mind must be slipping.
The following code fails to get the color of the pixel and I can't see why. If I remark out the if endif testing for >120 the arrays fill and print to file but as zeros. Yes the pixel values are plenty high in red laser light
thanks for advice
Chuck
Dodic
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&Montenegro)
Posted: 9th Jan 2006 05:58
Quote: "Error obtaining Source Code, invalid ID. Sorry but I've given up.
"



mohawk
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United States
Posted: 9th Jan 2006 06:01
well looks like I better try again with the source.
[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


/code]the above prints out o ;0 ;120 for every pass
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Jan 2006 06:06
The source doesn't work for people still in a newbie slap. You need to put your code in code snips.

[ code ]
Your code here.
[ /code ]

Just remove the spaces between the brackets and we see this:




mohawk
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United States
Posted: 9th Jan 2006 06:11
Oh for heavens sake I'll try one last time

better I hope
mohawk
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United States
Posted: 9th Jan 2006 06:16
Moderator please kill thread I'll try again after some sleep
Dave J
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 9th Jan 2006 12:46
Paste the code into the 'Message' section of the box, highlight with your mouse and then click the 'Code' button located just above this box.


"Computers are useless, they can only give you answers."
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Jan 2006 19:47
Quote: "Oh for heavens sake I'll try one last time

better I hope"


Don't give up so easily.


Dodic
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&Montenegro)
Posted: 9th Jan 2006 19:58
yeah , don`t give up...


Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Jan 2006 21:42

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.
mohawk
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United States
Posted: 10th Jan 2006 03:29
Figured it out after some sleep....I forgot to put the minus step in the horizontal loop
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 11th Jan 2006 07:25
Quote: "Is his code... He posted it already right?"


Apparently that message wasn't approved yet and somehow was skipped over several times.


Login to post a reply

Server time is: 2025-05-23 02:22:16
Your offset time is: 2025-05-23 02:22:16