Discuss Scratch

jerry1000
Scratcher
100+ posts

Color Detection???

Is it possible to make a script that can detect what color is at a certain place??? If so please take your time to give me a link to a project that can detect color. I don't know if its possible without block hacking. This would help a lot in my next project that, if working properly and gets finished, would be my best one (not like any of my other projects are very good anyways). Thanks for any help…

…Or maybe scratch can add a block like this to help me????

<color at x: (x position) y: (y position) ?>

Last edited by jerry1000 (Nov. 14, 2014 23:39:30)


. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . Shaper . . . . . . . . . . . . . . Save Christmas R.I.P Dynamic signatures
. . . . . . My browser / operating system: MacOS Macintosh X 10.12.0, Chrome 53.0.2785.143, Flash 23.0 (release 0)
drmcw
Scratcher
1000+ posts

Color Detection???

Yes it is possible http://scratch.mit.edu/projects/10941245/

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
jerry1000
Scratcher
100+ posts

Color Detection???

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/

Thanks soooo much!

P.S. Do you know how to change blue, red and green to an actual see-able color?

. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . Shaper . . . . . . . . . . . . . . Save Christmas R.I.P Dynamic signatures
. . . . . . My browser / operating system: MacOS Macintosh X 10.12.0, Chrome 53.0.2785.143, Flash 23.0 (release 0)
drmcw
Scratcher
1000+ posts

Color Detection???

jerry1000 wrote:

Do you know how to change blue, red and green to an actual see-able color?
Not sure what you mean but http://scratch.mit.edu/projects/12713728/ provides plenty o functions for changing between the different colour representations.

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
TheLogFather
Scratcher
1000+ posts

Color Detection???

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/
Curiously, I just noticed that no longer works reliably (e.g. it fails to detect pure white)…

It appears that the blue component of “touching color?” now has the same sensitivity as the red & green components (five bits, rather than the four bits it used to have).

That means the “repeat 16” now should become “repeat 32”, like the other two, and the “change b by 16” should also become “change b by 8”, like the other two…
And it's worth noting that means it'll likely take twice as long to find the right colour - and it was pretty slow before, since it has to check so many possibilities.

Wonder when that changed, and if it was intentional…?

Last edited by TheLogFather (Nov. 13, 2014 16:02:40)


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

dhdguysg
Scratcher
100+ posts

Color Detection???

jerry1000 wrote:

Is it possible to make a script that can detect what color is at a certain place??? If so please take your time to give me a link to a project that can detect color. I don't know if its possible without block hacking. This would help a lot in my next project that, if working properly and gets finished, would be my best one (not like any of my other projects are very good anyways). Thanks for any help…

…Or maybe scratch can add a block like this to help me????

<touching color at x: (x position) y: (y position) ?>
It's possible, Lemme show you a visual scratchblocks thing, this detects if the sprite: ScratchCat is touching this certain color
This detects if the scratch cat is touching blue when k is pressed
This script has to be ran in the spirte that you want it to detect if its touching that color
when [k v] key pressed
if <touching color [#0000ff] ?> then
say [Scratch cat is touching blue!] for (2) secs
else
say [Scratch cat is not touching blue!] for (2) secs
end
And thats all to it! (Btw i havent tested this script, i just tried to remeber from experince and i remebered this so it should work
(EDIT: Whoops! Sorry! I used a color detection for anywhere, sorry bout' dat..)

Last edited by dhdguysg (Nov. 13, 2014 15:18:25)

mrfire45
Scratcher
39 posts

Color Detection???

make a sprite that is at those points. use a broadcast that tells your sprite about it.

“Not only is the Universe stranger than we think, it is stranger than we CAN think”

http://scratch.mit.edu/users/mrfire45/

TheLogFather
Scratcher
1000+ posts

Color Detection???

TheLogFather wrote:

Wonder when that changed, and if it was intentional…?
Ah, ok: https://github.com/LLK/scratch-flash/issues/544

Guess that answers that then!

Last edited by TheLogFather (Nov. 13, 2014 18:04:44)


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

drmcw
Scratcher
1000+ posts

Color Detection???

TheLogFather wrote:

TheLogFather wrote:

Wonder when that changed, and if it was intentional…?
Ah, ok: https://github.com/LLK/scratch-flash/issues/544

Guess that answers that then!

One step forward two steps back

or should that be
move (1) steps
move (-2) steps
?

Last edited by drmcw (Nov. 13, 2014 18:09:35)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
jerry1000
Scratcher
100+ posts

Color Detection???

TheLogFather wrote:

Curiously, I just noticed that no longer works reliably (e.g. it fails to detect pure white)…

…So, doesn't it work anymore?

. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . Shaper . . . . . . . . . . . . . . Save Christmas R.I.P Dynamic signatures
. . . . . . My browser / operating system: MacOS Macintosh X 10.12.0, Chrome 53.0.2785.143, Flash 23.0 (release 0)
TheLogFather
Scratcher
1000+ posts

Color Detection???

jerry1000 wrote:

TheLogFather wrote:

Curiously, I just noticed that no longer works reliably (e.g. it fails to detect pure white)…
…So, doesn't it work anymore?
It's fine now - the recent update to v428a reverted the change.


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

jerry1000
Scratcher
100+ posts

Color Detection???

TheLogFather wrote:

jerry1000 wrote:

TheLogFather wrote:

Curiously, I just noticed that no longer works reliably (e.g. it fails to detect pure white)…
…So, doesn't it work anymore?
It's fine now - the recent update to v428a reverted the change.


Great!

. . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . Shaper . . . . . . . . . . . . . . Save Christmas R.I.P Dynamic signatures
. . . . . . My browser / operating system: MacOS Macintosh X 10.12.0, Chrome 53.0.2785.143, Flash 23.0 (release 0)
gilbert_given_189
Scratcher
500+ posts

Color Detection???

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/
One problem. When i detect an clear white color, it always not say 255/255/255!
Anyone can help?

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
Scratch-Minion
Scratcher
1000+ posts

Color Detection???

gilbert_given_189 wrote:

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/
One problem. When i detect an clear white color, it always not say 255/255/255!
Anyone can help?

DadOfMrLog says in his project:
The colour checker appears to only check the first 5 bits of the red & green components, and the first 4 bits of the blue component.
This means the total checks needed to find a match is 32*32*16, rather than the expected 256*256*256 (which is >16 million).
It also means, for example, ‘white’ would match:
red=248 to 255, green=248 to 255, blue=240 to 255

ie. White is equivalent to a range of values!
If you use his color detector, white will be recorded as 248, 248, 240, which is correct within the possible accuracy of Scratch color detection.

You can modify his code to test first for 255, 255, 255 (or convert 248, 248, 240 to this value).
255, 255, 255 produces a pure white when redrawn while 248, 248, 240 is visibly off-white when redrawn.
gilbert_given_189
Scratcher
500+ posts

Color Detection???

Scratch-Minion wrote:

gilbert_given_189 wrote:

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/
One problem. When i detect an clear white color, it always not say 255/255/255!
Anyone can help?

DadOfMrLog says in his project:
The colour checker appears to only check the first 5 bits of the red & green components, and the first 4 bits of the blue component.
This means the total checks needed to find a match is 32*32*16, rather than the expected 256*256*256 (which is >16 million).
It also means, for example, ‘white’ would match:
red=248 to 255, green=248 to 255, blue=240 to 255

ie. White is equivalent to a range of values!
If you use his color detector, white will be recorded as 248, 248, 240, which is correct within the possible accuracy of Scratch color detection.

You can modify his code to test first for 255, 255, 255 (or convert 248, 248, 240 to this value).
255, 255, 255 produces a pure white when redrawn while 248, 248, 240 is visibly off-white when redrawn.
So how to make an clean white colour?

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
JT2600
Scratcher
3 posts

Color Detection???

dhdguysg wrote:

jerry1000 wrote:

Is it possible to make a script that can detect what color is at a certain place??? If so please take your time to give me a link to a project that can detect color. I don't know if its possible without block hacking. This would help a lot in my next project that, if working properly and gets finished, would be my best one (not like any of my other projects are very good anyways). Thanks for any help…

…Or maybe scratch can add a block like this to help me????

<touching color at x: (x position) y: (y position) ?>
It's possible, Lemme show you a visual scratchblocks thing, this detects if the sprite: ScratchCat is touching this certain color
This detects if the scratch cat is touching blue when k is pressed
This script has to be ran in the spirte that you want it to detect if its touching that color
when [k v] key pressed
if <touching color [#0000ff] ?> then
say [Scratch cat is touching blue!] for (2) secs
else
say [Scratch cat is not touching blue!] for (2) secs
end
And thats all to it! (Btw i havent tested this script, i just tried to remeber from experince and i remebered this so it should work
(EDIT: Whoops! Sorry! I used a color detection for anywhere, sorry bout' dat..)

remeber
gilbert_given_189
Scratcher
500+ posts

Color Detection???

gilbert_given_189 wrote:

Scratch-Minion wrote:

gilbert_given_189 wrote:

drmcw wrote:

Yes it is possible http://scratch.mit.edu/projects/10941245/
One problem. When i detect an clear white color, it always not say 255/255/255!
Anyone can help?

DadOfMrLog says in his project:
The colour checker appears to only check the first 5 bits of the red & green components, and the first 4 bits of the blue component.
This means the total checks needed to find a match is 32*32*16, rather than the expected 256*256*256 (which is >16 million).
It also means, for example, ‘white’ would match:
red=248 to 255, green=248 to 255, blue=240 to 255

ie. White is equivalent to a range of values!
If you use his color detector, white will be recorded as 248, 248, 240, which is correct within the possible accuracy of Scratch color detection.

You can modify his code to test first for 255, 255, 255 (or convert 248, 248, 240 to this value).
255, 255, 255 produces a pure white when redrawn while 248, 248, 240 is visibly off-white when redrawn.
So how to make an clean white colour?
Actually, nevermind. #f8f8f0 looks a bit clean.

If you see a line above this text, it means that below this text is my signature.
This place is just a memory to me, I may return occasionally but I'm busy.
I guess I'm an ATer now.

I think I may have seasoned my posts a bit too much.


Colored Pencil is supposed to color the siggy, but Scratch says it's too big.


There is nothing here…



don don pan pan
dondo pan pan
WilyGravy57
Scratcher
39 posts

Color Detection???

Guys, presenting to real colour detector idea (slowest project ever)
Run a variable, convert it to hex and do
if <touching color (join [0x] (hex code)) ?> then

end
If this is true, you get your colour code which is your hex code!

When [scratch icon v] clicked::hat extension //always true, works for all
repeat until <you are scratcher::looks>{
if ([scratchers v] got [many v] likes::list){
think [myself v] [They really love scratch]::variables
}(Select, you are good::grey)::operators
if ([scratchers v] got [no v] likes::list){
think [myself v] [They are just jealous...]::variables
}(Select, you are bad::grey)
}::sensing
WilyGravy57
Scratcher
39 posts

Color Detection???

Credits to a scratch wiki that shows how to convert hex code to a touching color ()? input format.

When [scratch icon v] clicked::hat extension //always true, works for all
repeat until <you are scratcher::looks>{
if ([scratchers v] got [many v] likes::list){
think [myself v] [They really love scratch]::variables
}(Select, you are good::grey)::operators
if ([scratchers v] got [no v] likes::list){
think [myself v] [They are just jealous...]::variables
}(Select, you are bad::grey)
}::sensing
Hansmands
Scratcher
9 posts

Color Detection???

There is a workaround
repeat until <touching color [(color)] ?>>
change [color] by (1000)
end

Powered by DjangoBB