I guess I was making it too easy on myself. I am trying to do this but I get stuck in the line which says arraysomething -line 44. Could anyone put me in the right direction on how to get the 16 color values in an array and than start working with the values in that array?
PImage img;
int bigSector = 4;
int mediumSector = 2;
int smallSector = 1;
int updown = 0;
int leftright = 0;
int zoom = 1;
int r=0;
int g=0;
int b=0;
void setup() {
size(960, 1240);
smooth();
img = loadImage("source.png");
noStroke();
}
void draw() {
scale(zoom);
translate(leftright, updown);
image(img,0,0);
getDataFromImage() //translate image color info to data file
}
void getDataFromImage()
{
img.loadPixels();
int sectorX=1; // the first part of the sectorname which is sectorX_sectorY -> 1_1 or 3_6
int x = 0;
while (x<img.width); // to be delayed in every step otherwise the program crashes
{
int y = 0;
int sectorY = 1 // the second part of the sectorname which is sectorX_sectorY -> 1_1 or 3_6
while (y<img.height); // to be delayed in every step otherwise the program crashes
{
renderSectors();
}
renderSectors() {
int sectorNumber = 1;
for (int i=x ; i< sectorNumber * bigSector; i++){ // read 4 pixels horizontal
for(int j=y; j< sectorNumber * bigSector; j++){ // read 4 pixels vertical
// arraysomething = pixels(); // make array with bigSector * bigSector times pixel color value values
// if all color values are equal
outputSectorData();
// fill(uniform color of pixels)
rect(x,y,bigTile,bigTile)
// else divide subsector to subsector with sectorSize = 2 by 2
// if all color values are equal
outputSectorData();
// fill(uniform color of pixels)
// else divide subsector to sectorSize = 1 by 1
outputSectorData();
}
}
}
void outputSectorData() // oemfto woemfti that will be a lot of data
{
System.Out.println("Sectorname =" + sectorX + "_" + sectorY);
System.Out.println("Sector Position X =" +x);
System.Out.println("Sector Position Y =" +y);
System.Out.println("sector number" + sectorNumber + "is of size" + sectorSize + "and has X position"+ x + "and Y position" + y);
}
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
updown = updown-30;
} else
if (keyCode == DOWN) {
updown = updown+30;
} else
if (keyCode == LEFT) {
leftright = leftright-30;
} else
if (keyCode == RIGHT) {
leftright = leftright+30;
}
}
if(key == '+') {
zoom = zoom +1;
}
else if (key == '-') {
if (zoom > 1) {
zoom = zoom -1;
}
Else {
zoom = 1;
}
}
}