English
Forum

Done: Color difference detect

 

KHR
Hello together,

I Search a routine, with the itself to charge can, whether two colours for our eye enough of each other deviation, say we enough Farbkontrast having circa deutliche Abgrenzug To make possible.

as example have I here a Democode, the Rechtecke with Zufallsfarben darstellt.

mostly weichen these colours vigorously of each other ex. sometimes are you but unfortunately very akin.

How can I the in the program-term discern, circa z.B. The Zufallsfarbe new to charge To let??
CompileMarkSeparation
declare farbe&, size&
cls
randomize
size& = 210

while 1

    whileloop (size&/10/2)

        farbe& = @rgb(@rnd(256),@rnd(256),@rnd(256))
        usebrush 1,farbe&
        UsePen 5,0,farbe&
        rectangle   (&loop*10),(&loop*10) - (size&-(&loop*10)),(size&-(&loop*10))

    endwhile

    waitinput 400
    cls

Gruß
Karl-Heinz
WIN XP home/Pro / XPROFAN 11 / P2CPP
ATMEL + BASCOM Fan
03/14/09  
 



Something like?

Ähnlichkeit To Black:
CompileMarkSeparation
or.
CompileMarkSeparation
proc FARBAEHNLICHKEIT

    PARAMETERS FARBE1&,FARBE2&
    RETURN (ABS(GETRVALUE(FARBE1&)-GETRVALUE(FARBE2&))+ABS(GETGVALUE(FARBE1&)-GETGVALUE(FARBE2&))+ABS(GETBVALUE(FARBE1&)-GETBVALUE(FARBE2&))) * 0.001307189542483660130718954248

endproc


How our eye becomes here however unregarded there our eyes RGB not linear erfassen separate durchschnittlich sooner to ruddy+green and yellow(=Rot+green)+blue and brightness. (hierbei but faith I do not vordergründig)

anyway but gives these function not from, that ruddy and green or blue and ruddy same are.

The Ähnlichkeit To knows would given, if the Return Value 1-x taken would.
 
03/14/09  
 




KHR
Hello David

thanks for your Solution. I habs time into bicycles reingebastelt.
CompileMarkSeparation
Fahrräder
by Karl-Heinz Rattay / 2009
einfach ausprobieren
Wems gefällt der kann ja einen screensaver draus machen!
Dieses Modul ist einfach so wie es ist. Wems nicht gefällt, der kann umstricken!!
declare  r&, g&, b&, diff&, mix&, lastmix&
declare Zaehler&

proc zeichne

    parameters c&,hpos%,vpos%, size%
    usepen   0,(size%/5),c&
    useBrush 0,c&
    ellipse (hpos%-(Size%/1.5)),(vpos%-(Size%/1.5)) - (hpos%+(Size%/1.5)),(vpos%+(Size%/1.5))
    ellipse ((hpos%+size%*2.0)-(Size%/1.5)),(vpos%-(Size%/1.5)) - ((hpos%+size%*2.0)+(Size%/1.5)),(vpos%+(Size%/1.5))
    usepen   0,(size%/8),c&
    moveto hpos%,vpos%
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1.05))
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*0.95) + (size%/6))
    lineto (hpos%+(size%*1.1))  , vpos%
    moveto (hpos%+(size%/4)),(vpos% - (Size%*1.3))
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1.3))
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1))
    lineto (hpos%+(size%*1.1))  , vpos%
    lineto (hpos%+(size%*2))  , vpos%
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*1) + (size%/6))
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*1) -(size%/7))
    moveto (hpos%+(size%*1.7)-(size%/5))   , (vpos% - (Size%*1.1) -(size%/8))
    lineto (hpos%+(size%*1.7)+(size%/5))   , (vpos% - (Size%*1.1) -(size%/8))
    moveto (hpos%+(size%*1.1))  , (vpos%-(size%*0.3))
    lineto (hpos%+(size%*1.1))  , (vpos%+(size%*0.3))

Endproc

proc FARBAEHNLICHKEIT

    PARAMETERS FARBE1&,FARBE2&
    RETURN (ABS(GETRVALUE(FARBE1&)-GETRVALUE(FARBE2&))+ABS(GETGVALUE(FARBE1&)-GETGVALUE(FARBE2&))+ABS(GETBVALUE(FARBE1&)-GETBVALUE(FARBE2&))) * 0.001307189542483660130718954248

endproc

cls
showmax
randomize

while 1

    inc zaehler&

    if zaehler& > 80

        while 1

            r&=Rnd(256)
            g&=Rnd(256)
            b&=Rnd(256)
            mix&=@rgb(r&,g&,b&)
            Case FARBAEHNLICHKEIT (lastmix&,mix&) :CONTINUE
            lastmix&=mix&
            BREAK

        endwhile

        zeichne  @rgb(r&,g&,b&) ,
        ((%maxx*0.6) + @rnd(%maxx/4)) ,
        (100+@rnd(@rnd(%maxy*0.85))) ,
        (15+@rnd(40))
        zaehler& = 1

    endif

    copyBmp 1,0 - %maxx,%maxy > 0,0;0
    case @IsKey(27) : end    ESC gedrückt

s4 href='./../../Function-References/XProfan/endwhile/'>endwhile


I bid moreover as comparison The Solution from the Nachbarforum on.
CompileMarkSeparation
bicycles
by Karl-Heinz Rattay / 2009
simply try
Wems gefällt the can Yes a screensaver draus make!
this Module is simply so How it is. Wems not gefällt, the can umstricken!!
declare  r&, g&, b&, diff&, mix&, lastmix&
declare Zaehler&

proc draw

    parameters c&,hpos%,vpos%, size%
    usepen   0,(size%/5),c&
    useBrush 0,c&
    ellipsis (hpos%-(Size%/1.5)),(vpos%-(Size%/1.5)) - (hpos%+(Size%/1.5)),(vpos%+(Size%/1.5))
    ellipsis ((hpos%+size%*2.0)-(Size%/1.5)),(vpos%-(Size%/1.5)) - ((hpos%+size%*2.0)+(Size%/1.5)),(vpos%+(Size%/1.5))
    usepen   0,(size%/8),c&
    moveto hpos%,vpos%
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1.05))
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*0.95) + (size%/6))
    lineto (hpos%+(size%*1.1))  , vpos%
    moveto (hpos%+(size%/4)),(vpos% - (Size%*1.3))
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1.3))
    lineto (hpos%+(size%/6)),(vpos% - (Size%*1))
    lineto (hpos%+(size%*1.1))  , vpos%
    lineto (hpos%+(size%*2))  , vpos%
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*1) + (size%/6))
    lineto (hpos%+(size%*1.7))   , (vpos% - (Size%*1) -(size%/7))
    moveto (hpos%+(size%*1.7)-(size%/5))   , (vpos% - (Size%*1.1) -(size%/8))
    lineto (hpos%+(size%*1.7)+(size%/5))   , (vpos% - (Size%*1.1) -(size%/8))
    moveto (hpos%+(size%*1.1))  , (vpos%-(size%*0.3))
    lineto (hpos%+(size%*1.1))  , (vpos%+(size%*0.3))

Endproc

cls
showmax
randomize

while 1

    inc zaehler&

    if zaehler& > 80

        while 1

            r&    = Rnd(256)
            g&    = Rnd(256)
            b&    = Rnd(256)
            mix&  =(r&+g&+b&)/3
            diff& = Abs(lastmix&-mix&)
            Case diff&<40   :  CONTINUE
            lastmix& = mix&
            BREAK

        endwhile

        draw  @rgb(r&,g&,b&) ,
        ((%maxx*0.6) + @rnd(%maxx/4)) ,
        (100+@rnd(@rnd(%maxy*0.85))) ,
        (15+@rnd(40))
        zaehler& = 1

    endif

    copyBmp 1,0 - %maxx,%maxy > 0,0;0
    case @IsKey(27) : end    ESC pressed

endwhile


can someone Differences in the Farbverteilung discern?

I faith already something recognized to have, with the Result were I but - Perhaps reports itself indeed someone of you
 
Gruß
Karl-Heinz
WIN XP home/Pro / XPROFAN 11 / P2CPP
ATMEL + BASCOM Fan
03/14/09  
 



The Difference is, that the Algo r+g+b colourblind is. One rotes Pixel is thereafter just as wertig like a Grünes, what then but nothing more To do has with whether two colours for our eye enough of each other deviation.
 
03/14/09  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.886 Views

Untitledvor 0 min.
Torsten Boo07/29/21
Michael W.07/03/16
Julian Schmidt06/19/13

Themeninformationen

this Topic has 2 subscriber:

iF (2x)
KHR (2x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie