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
How to resize a movie object? (Read 1324 times)
How to resize a movie object?
Apr 7th, 2010, 2:03pm
 
Hi, my first post here. I've searched the question around but it's either so obvious that no one ever even asked it or I'm a complete fool and haven't find it.

Anyway, I need to resize a movie object after importing it. I developed my whole sketch using the Capture object as a good way of getting some quick video info in but now i'm trying to port it to use a Movie object and the main problem I've encountered is resizing the video.

with a Capture object i can only say:

video = new Capture(this,width/s,height/s,60);

for example.

but how do I achieve the same effect with a movie object.

If it helps. I'm trying to resize the movie to a certain scale based on the sketch window so I keep a scale relationship with the size of the sketch.

It was so easy with the Capture object that i'd like to think there's a very simple way of doing it with the movie object and i'm just not being smart enough to find out about .

Any help would be incredibly appreciated.
Re: How to resize a movie object?
Reply #1 - Apr 7th, 2010, 11:32pm
 
with movies and captures, the image source resolution doesnt need to be your output resolution. for example if you want 320x240 webcam image cause it is faster to capture and still want to show it 640x480 you can easily resize it.
Same with the movie objects.
you just need to define a width and height in image() when drawing them. like in this example :

import processing.video.*;
Movie myMovie;

void setup() {
 size(200, 200);
 myMovie = new Movie(this, "totoro.mov");
 myMovie.loop();
}

void draw() {
 tint(255, 20);
 image(myMovie, 0,0,width,height);
}

// Called every time a new frame is available to read
void movieEvent(Movie m) {
 m.read();
}
Re: How to resize a movie object?
Reply #2 - Apr 8th, 2010, 3:58am
 
Hey Cedric, thanks so much for the fast response. But I'm afraid that is still not solving it, unfortunately.

I'm trying to do one of those pixelation effects, and to do that what I do is, I cover the screen in a matrix of big 20x20 "pixels" and I use the video data to color those "pixels".

To do that I need the information source(the movie) to be in a scale of 1/20 to the screen, no matter what the screen size is.

With a capture object thats easy to do as I can easily set it's size, but with the solution you provided me before I only change the display size of the video and not the information source size. Is that at least mildly clear? Smiley

What I think might be a solution is if I could somehow store that data that is displayed by using:

image("myvideo",0,0,w,h)

into something than then becomes my information source.

Is there any way of doing that?

Thanks,

Pablo
Re: How to resize a movie object?
Reply #3 - Apr 8th, 2010, 5:11pm
 
I'm bookmarking this thread.  Trying to figure out the same thing.
Re: How to resize a movie object?
Reply #4 - Apr 8th, 2010, 11:43pm
 
I once tried a similar thing and did it as follows
- get the color of the source image by the get() function
- "painted" the target image with rect(), filled with that color in any size.

hope that hepls.
Page Index Toggle Pages: 1