Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Multi dimension arrays

$
0
0

@on4now4 wrote:

I just started working with pictures a little bit and you can see in my code somewhat what I am trying to do but I have commented it out to try a much simpler thing and my code still crashes. Can anyone please tell me what I have done wrong? It seems so simple and I just see no reason why the printf statement causes a crash...

#include "ofApp.h"
int width, height;
ofImage myImage;
//--------------------------------------------------------------
void ofApp::setup(){
myImage.loadImage("image.jpg");
width = myImage.width;
height = myImage.height;
printf("W: %d   H: %d",width,height);

unsigned char *pixles;
pixles = myImage.getPixels();
unsigned char pixColor[10000][10000];
unsigned char pixBlack[3000][30000];

myImage.setFromPixels((unsigned char*)pixles,width,height,OF_IMAGE_COLOR);

/*
int i,j,counter = 0;
for( i = 0 ; i < 3*height ; i++){
for(j = 0 ; j < 3*width ; j++){
    pixColor[i][j] = *(pixles);
    counter++;
}
}
*/
pixColor[0][0] = 15;
printf("\n1:%d",pixColor[0][0]);



}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles