344
edits
(Created page with "Processing v3.0.1 Quellcode: <br> <source lang="java"> float[] pixefs; ArrayList< Integer > neighbours; int area = 1; float influence = 0.75f; float power = 3.5f; void setup...") |
No edit summary |
||
Line 4: | Line 4: | ||
<source lang="java"> | <source lang="java"> | ||
float[] pixefs; | float[] pixefs; | ||
ArrayList< Integer > | ArrayList< Integer > Farbe; | ||
int area = 1; | int area = 1; | ||
Line 14: | Line 14: | ||
size( 1366,768 ); | size( 1366,768 ); | ||
PImage im = loadImage( " | PImage im = loadImage( "bild.jpg" ); | ||
background( 255 ); | background( 255 ); | ||
image( im, 0, 0, width, height ); | image( im, 0, 0, width, height ); | ||
Farbe = new ArrayList< Integer >(); | |||
loadPixels(); | loadPixels(); | ||
Line 37: | Line 37: | ||
continue; | continue; | ||
if ( active( x, y ) ) { | if ( active( x, y ) ) { | ||
// println( x +" / "+ y + " | // println( x +" / "+ y + "hat die letzte angrenzende Farbe schwarz" ); | ||
getFarbe( x, y, area ); | |||
float inf = influence / | float inf = influence / Farbe.size(); | ||
for ( int i = 0; i < | for ( int i = 0; i < Farbe.size(); i++ ) { | ||
int nid = | int nid = Farbe.get( i ); | ||
pixefs[ nid ] -= inf * pow( ( 255.f / pixefs[ nid ] ), power ); | pixefs[ nid ] -= inf * pow( ( 255.f / pixefs[ nid ] ), power ); | ||
if ( pixefs[ nid ] < 0 ) | if ( pixefs[ nid ] < 0 ) | ||
Line 69: | Line 69: | ||
} | } | ||
void | void getFarbe( int x, int y, int range ) { | ||
Farbe.clear(); | |||
for ( int ty = y-range; ty <= y+range; ty++ ) { | for ( int ty = y-range; ty <= y+range; ty++ ) { | ||
if ( ty < 0 ) | if ( ty < 0 ) | ||
Line 83: | Line 83: | ||
if ( tx == x && ty == y ) | if ( tx == x && ty == y ) | ||
continue; | continue; | ||
Farbe.add( tx + ty * width ); | |||
} | } | ||
} | } |
edits