We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
resize a 10x8 pixel web cam capture (Read 1359 times)
resize a 10x8 pixel web cam capture
Nov 22nd, 2009, 3:28pm
 
Hi and sorry for that question,

i would like to process a live picture i get direct from USB Web-cam.

1. It is needful to know how is the right way to resize a 10x8 pixel web cam capture directly in to a bigger size like 640x380pixel with big pixel blogs.
2. Also i need to get every data from this 80 pixels as ARGB or BW information.


How can i start this to be happy?

Kind regards
Smiley
Re: resize a 10x8 pixel web cam capture
Reply #1 - Nov 22nd, 2009, 3:35pm
 
as you insert your webcam image using image() you can define the width and height of your image like this :
image(img, x, y, width, height)

to get the colorinformation you can use either http://processing.org/reference/loadPixels_.html

or

http://processing.org/reference/get_.html
Re: resize a 10x8 pixel web cam capture
Reply #2 - Nov 26th, 2009, 2:37pm
 
OK, nice:-)
But witch way i can print every pixel data in a list of int?? I am stupid Undecided
--------------
import processing.video.*;

Capture cam;

void setup() {
 size(640,480);
 cam = new Capture(this,10, 8);
}


void draw() {
 if (cam.available() == true) {
   cam.read();
   
   cam.filter(GRAY);
   cam.loadPixels();
   
   image(cam, 30, 30, width, height);
 }
}
Re: ok i get it :-J for one pixel...and NOW?
Reply #3 - Nov 27th, 2009, 1:35pm
 
OK, this is my result. Its my beginner result of first-contact with programming after 15h. Yeaa!

And now the next problem. How i can send this 32bit color code to an USB card for servo controlling?????
Please help me, ...please!

THX

import processing.video.*;

Capture cam;
Capture cam1;

void setup() {
 size(840, 680);
 cam = new Capture(this, 10, 8, 24);
 
}


void draw() {
   rect(67,84,2,2);
   noFill();
   stroke(255);
 
 if (cam.available() == true) {
   cam.read();
 
   cam.filter(GRAY);
   loadPixels();
//    pixels[69*width+68];
   println("color  " + get(68,85));
   
   image(cam, 50, 50, 200, 160);
 }
 image(cam, 50, 300, 200, 160);
 
}
Smiley Smiley Smiley
Page Index Toggle Pages: 1