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.
IndexProgramming Questions & HelpPrograms › How can I downscale an image without drawing it
Page Index Toggle Pages: 1
How can I downscale an image without drawing it (Read 828 times)
How can I downscale an image without drawing it
Jan 26th, 2008, 2:47pm
 
Hello there.

I´m trying the following:
I´ve got an image from an online-webcam that shoult be analysed to do some brightness tracking for detecting motion.
I don´t want to draw the image itself on the screen. Therefore I analyse the picture in the background, by cutting out the relevant part of it:
.
.
imgSource = loadImage(urlSource);
PImage imagepart = imgSource.get (20,20,300,200);
imagepart.loadPixels();
.
.

Then I do the tracking...

The problem is, that I want to do this with a bunch of different cams and the program can´t handle it anymore. What I thought to do was downscaling the images and then analyse those smaller images, so the program can handle it again.
But I simply don´t know how/where I should tell processing to downscale them. The only way I know by now to get smaller images is to take a smaller part of the source image. But that´s not what I want...

Hopefully someone can help me and hopefully my question is not too stupid ;-)

Thank you...
Re: How can I downscale an image without drawing i
Reply #1 - Jan 26th, 2008, 3:17pm
 
blobdetection has a good example for downscaling images:
http://www.v3ga.net/processing/BlobDetection/index-page-examples.html

short:
Code:

size(640,480);
PImage cam = loadImage("http://webcam.kurfuerstendamm.de/record/current.jpg");
PImage img = new PImage(320, 240);
img.copy(cam, 0, 0, cam.width, cam.height, 0, 0, img.width, img.height);

image(cam, 0, 0, width, height);
filter(GRAY);
image(img, width/2, height/2);


that should be mentioned in the reference.

greetings

michael
Page Index Toggle Pages: 1