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
Scale Up JMyron Feed (Read 733 times)
Scale Up JMyron Feed
Jun 11th, 2009, 2:36pm
 
Hey,

So I've been playing around with the JMyron library a lot over the past couple months and I've really been enjoying it. In expanding my app I keep running into this desire to scale up my feed and I always get stuck.

Basically, to keep the speed fast I need to catch my footage from my camera at 320x240, but I want to scale my footage up to 640x480. So, I figured in my pixel array I could just set the for loop to be the number of pixels I want as my output and double up pixels so that 1 pixels from my original array contains the same data as 4 pixels in my new array. This is what I did

Code:
  m.update(); //JMyron call
 int[] img = m.image(); //the camera 320x240
 
 loadPixels();
 for(int i=0;i<640*480;i++) {
   pixels[i] = img[i/4];  //the output
 }
 updatePixels();


This I realized does not give the desired output as pixels go horizontally from left to right not in blocks of 4...I need to output my array from AAAABBBBCCCCDDDD to AABBCCDDAABBCCDD

Anyone have any suggestions??? Thanks

-Jono
Re: Scale Up JMyron Feed
Reply #1 - Jun 12th, 2009, 2:54am
 
something like
Code:
PImage img = m.image();
PImage newimg = img.resize(640,480);


is problably the easiest way.

different ways could include drawing a 2x2px square for every pixel in the image or similar stuff.
Re: Scale Up JMyron Feed
Reply #2 - Jun 12th, 2009, 10:08am
 
Thanks for your input naus3a. I should've mentioned that I tried doing this, but I had conversion issues from int[] to PImage...JMyron's image() callback appears to be different from Processing's image() callback. I figured that it just wasn't possible, but maybe that is the more relevant question?

How do you convert an array of integers into a PImage?
Page Index Toggle Pages: 1