Image / Video / Arduino / Ambient light
in
Programming Questions
•
3 years ago
Hello,
Im new to processing and i'm liking it. I got my self an arduino and im trying to make a project (ambient light) on my own.
My arduino is alrady set up.
I'm having more of an idea problem and a tech one at the same time.
I wan't to make an apliation that would get the currently viewing image of my PC and calculate the avrage RGB value and send it to arduino. I want it to work when i play games, watch movies, or doing whatever.
I figured that procesing the whole image can't be done on the fly so i was thinking of taking sreenshots as fast as posible but save them in a very low resolution and quality (i don't need the avrage RGB value to be that exact) so it dosen't eat all the CPU.
Any bright ideas how to get this working and not burning all the CPU's power just to get the damn RGB?
Now the second thing bugs me the most.
I was trying to get an example working, opening a simple jpg (just a blue sqare) and with 2 for loops going trugh every pixel and printing its value. I read that the img.get() function returns the RGB value of the pixel if provided the x and y cordinates of the pixel as parameters.
I've done this example but it just prints a bunch of negative numbers i can't make any sence of :(
Thanks for the help and ideas.
Im new to processing and i'm liking it. I got my self an arduino and im trying to make a project (ambient light) on my own.
My arduino is alrady set up.
I'm having more of an idea problem and a tech one at the same time.
I wan't to make an apliation that would get the currently viewing image of my PC and calculate the avrage RGB value and send it to arduino. I want it to work when i play games, watch movies, or doing whatever.
I figured that procesing the whole image can't be done on the fly so i was thinking of taking sreenshots as fast as posible but save them in a very low resolution and quality (i don't need the avrage RGB value to be that exact) so it dosen't eat all the CPU.
Any bright ideas how to get this working and not burning all the CPU's power just to get the damn RGB?
Now the second thing bugs me the most.
I was trying to get an example working, opening a simple jpg (just a blue sqare) and with 2 for loops going trugh every pixel and printing its value. I read that the img.get() function returns the RGB value of the pixel if provided the x and y cordinates of the pixel as parameters.
I've done this example but it just prints a bunch of negative numbers i can't make any sence of :(
Thanks for the help and ideas.

- PImage img;
void setup() {
size(50, 50);
noFill();
stroke(255);
img = loadImage("nekaj.jpg");
colorMode(RGB,255,255,255);
for (int i =0; i< 50; i++){
for(int j=0;j<50;j++){
System.out.println(img.get(i,j));
}
}
System.out.println("done!");
}
void draw(){
image(img, 0, 0);
}
1