OCCRA
Go to Post If you smack the bear with a stick, you'd better be ready for a mauling. - sciguy125 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-13-2007, 07:07 PM
BrianR BrianR is offline
Registered User
AKA: Brian Roehl
FRC #1525 (Warbots)
Team Role: Electrical
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Deerfield, IL
Posts: 79
BrianR has a spectacular aura aboutBrianR has a spectacular aura about
Send a message via AIM to BrianR
Resizing Camera View

I was wondering if it was possible to resize the viewing area of the camera during operation. Would you have to put a physical lens on the camera, or is it possible to have the camera ignore say, the right half of the image that it takes in as input?

If this is possible, it would make it much easier to focus on a single light when you encounter an orientation that presents two lights in your field of view.
  #2   Spotlight this post!  
Unread 01-13-2007, 07:11 PM
Binome's Avatar
Binome Binome is offline
Programmer/Electronics/CAD
AKA: Patrick
FRC #2273 (SHIM)
Team Role: Leadership
 
Join Date: Dec 2006
Rookie Year: 2007
Location: Surrey,BC
Posts: 105
Binome is a glorious beacon of lightBinome is a glorious beacon of lightBinome is a glorious beacon of lightBinome is a glorious beacon of lightBinome is a glorious beacon of light
Re: Resizing Camera View

i'm pretty sure there is a way to limit the viewing area through software
  #3   Spotlight this post!  
Unread 01-13-2007, 07:32 PM
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #2586
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Holly, MI
Posts: 715
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan Send a message via Skype™ to JBotAlan
Re: Resizing Camera View

First off, after looking at our goal for awhile, I don't think you will find a configuration where the CMUcam's field of view covers two lights.

With that out of the way, I think the VW function is what you seek:
Quote:
Originally Posted by CMUcam manual
VW [ x y x2 y2 ] \r
This command sets the Virtual Window size of the camera. It accepts the x and y Cartesian coordinates of the upper left corner (1,1) followed by the lower right of the window you wish to set. The origin is located at the upper left of the field of view. VW can be called before an image processing command to constrain the field of view. Without arguments it returns to the default full window size of for the current combination of camera type, down-sampling and resolution mode.
You will need to do some research and digging in the camera code to make this work. I know there's a "write to serial port" function in Kevin Watson's code that you could use for this. My brain is so jelly-fied from this week that any pseudocode I wrote for you would be useless...sorry

JBot
__________________
This post brought to you by Jacob Rau.
Junior Electrical Engineer/Computer Engineer at Michigan Technological University
Former Programming/Electrical mentor for FRC3418 (Robo Riot)
Former Programming mentor for FRC2586 (Copper Robotics)
Alumni programmer of FRC68 (Truck Town Thunder)
I can help with programming problems. Let me know if you need help. (I don't bite )
  #4   Spotlight this post!  
Unread 01-13-2007, 07:38 PM
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 848
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog Send a message via Skype™ to Cuog
Re: Resizing Camera View

If you turn to page 55 in your CMUcam2 manual you will see the command for adjusting the virtual window size.

If you don't have the manual get it from kevin.org/frc

The command is: VW x y x2 y2

those are the corners of the frame, the default(full) size is 1,1,88,143

Edit: curses, JBotAlan beat me to it
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.

Join us in FIRSTchat
IRC: irc.freenode.net #firstchat

Last edited by Cuog : 01-13-2007 at 07:42 PM.
  #5   Spotlight this post!  
Unread 01-30-2007, 12:03 PM
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
Re: Resizing Camera View

I've tried using the VW command while the camera is streaming data (T packets from Track Color), and often it seems to shut the camera down.

What are the rules for sending a command to the camera? Call Camera_Idle first? Wait for an ACK?

I tried adding a state to Kevin's code between STATE_TWO and STATE_THREE, and the first call to Write_Camera_Module_Register times out. (no ACK returned). That's all I did - add a no-action state. (I want to put a Poll Mode command there but that didn't work so I took out the command and its wait for ack, thus adding a no-action state).
  #6   Spotlight this post!  
Unread 01-30-2007, 12:35 PM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,331
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Resizing Camera View

Quote:
Originally Posted by stevethetinker View Post
I've tried using the VW command while the camera is streaming data (T packets from Track Color), and often it seems to shut the camera down.

What are the rules for sending a command to the camera? Call Camera_Idle first? Wait for an ACK?

I tried adding a state to Kevin's code between STATE_TWO and STATE_THREE, and the first call to Write_Camera_Module_Register times out. (no ACK returned). That's all I did - add a no-action state. (I want to put a Poll Mode command there but that didn't work so I took out the command and its wait for ack, thus adding a no-action state).
Yes, you need to call Camera_Idle( ) before calling Virtual_Window( ), waiting for ACKs after each.

If you want to call Virtual_Window( ) from the initialization function, this is a fragment from some code I'm working on:


Code:
case STATE_SIXTEEN:
// initialize the Noise Filter value
Noise_Filter(Camera_Config_Data.NF);
// next state
state = STATE_SEVENTEEN;
// wait for an ACK before transitioning to the next state
wait_for_ack =1;
break;
 
case STATE_SEVENTEEN:
// set window size
Virtual_Window(60, 100, 100, 239);
// next state
state = STATE_EIGHTEEN;
// wait for an ACK before transitioning to the next state
wait_for_ack =1;
break;
 
case STATE_EIGHTEEN:
// send the TC or Track Color command
Track_Color(Camera_Config_Data.R_Min, 
Camera_Config_Data.R_Max,
Camera_Config_Data.G_Min,
Camera_Config_Data.G_Max,
Camera_Config_Data.B_Min,
Camera_Config_Data.B_Max);
// next state
state = STATE_NINETEEN;
// wait for an ACK before transitioning to the next state
wait_for_ack =1;
break;
 
case STATE_NINETEEN:
// signal that we're done
return_value =1;
break;
-Kevin
__________________
Kevin Watson
Engineering consultant to
Space Exploration Technologies (SpaceX) and
Google Advanced Technologies and Projects
http://kevin.org
  #7   Spotlight this post!  
Unread 01-30-2007, 01:51 PM
Mike Mahar Mike Mahar is offline
Registered User
FRC #0138
 
Join Date: Jan 2007
Location: Amherst, NH
Posts: 64
Mike Mahar will become famous soon enough
Re: Resizing Camera View

Quote:
Originally Posted by Kevin Watson View Post
Yes, you need to call Camera_Idle( ) before calling Virtual_Window( ), waiting for ACKs after each.

-Kevin
Kevin, Are you sure about waiting for the ACK after Camera_Idle()? When I put in a wait there, I never got it. I noticed in you initialization code that you don't wait for an ACK after Camera_Idle(). When I took out the wait for the ACK, things worked a lot better. I did have to wait for an ACK after the Poll Mode funciton and Virtual_Window funciton that I called.
  #8   Spotlight this post!  
Unread 01-30-2007, 04:36 PM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,331
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Resizing Camera View

Quote:
Originally Posted by Mike Mahar View Post
Kevin, Are you sure about waiting for the ACK after Camera_Idle()? When I put in a wait there, I never got it. I noticed in you initialization code that you don't wait for an ACK after Camera_Idle(). When I took out the wait for the ACK, things worked a lot better. I did have to wait for an ACK after the Poll Mode funciton and Virtual_Window funciton that I called.
I could easilly be wrong (especially if you've tested it and it didn't work as I described ). I'll have a look at it tonight after I get home from the day gig.

-Kevin
__________________
Kevin Watson
Engineering consultant to
Space Exploration Technologies (SpaceX) and
Google Advanced Technologies and Projects
http://kevin.org
  #9   Spotlight this post!  
Unread 01-30-2007, 05:05 PM
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Resizing Camera View

The camera does not send an ACK after going into idle mode (which is kind of the point ). If you send "\r" again (or any other command that does not sleep the camera) it will "wake up" and ACK.
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
  #10   Spotlight this post!  
Unread 01-30-2007, 05:13 PM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,331
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Resizing Camera View

Just FYI, this is what the CMUcam2 manual has to say about the idle command:

"This command is used to set the camera board into an idle state. Like all other commands, you should receive the acknowledgment string “ACK” or the not acknowledge string “NCK” on failure. After acknowledging the idle command the camera board waits for further commands, which is shown by the ‘:’ prompt. While in this idle state a \r by itself will return an “ACK” followed by \r and : character prompt. This is how you stop the camera while in streaming mode."

-Kevin
__________________
Kevin Watson
Engineering consultant to
Space Exploration Technologies (SpaceX) and
Google Advanced Technologies and Projects
http://kevin.org
  #11   Spotlight this post!  
Unread 01-30-2007, 08:41 PM
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Resizing Camera View

Nevermind then, I stand corrected My apologies for the misinformation!
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.
  #12   Spotlight this post!  
Unread 01-31-2007, 03:31 PM
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
Re: Resizing Camera View

I found the edubot camera code (http://kevin.org/frc/edu_camera.zip), and it loads and cycles OK. But when I turn on the _DEBUG switch in the camera.h file, the debug output shows that camera initialization is timing out on the first CR command (no ACK or NCK back). I made no changes to the code except to turn on _DEBUG. Does anyone have a notion of what is going on? Here is the sequence of characters going out to the camera: 13, R, M, space, 5, \r, <state 1>, \r, <state 2>, <state 3>, C, R, 2, 41 (COMI), 128.
  #13   Spotlight this post!  
Unread 01-31-2007, 03:32 PM
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
Re: Resizing Camera View

In my above post, I put some notes in the output sequence going to the camera like this: <state n>. Those don't actually go out to the camera. They note where the state information is listed relative to the characters being written.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camera Help (New to Camera Programming) Idaman323 Programming 6 01-14-2006 02:56 AM
Camera View Size pyrr101 Programming 0 01-10-2006 09:42 PM
Image resizing tips? jpsaul7usa Chit-Chat 5 03-03-2005 11:52 PM
Resizing pictures.. Brandon Martus CD Forum Support 4 02-26-2004 02:22 PM
Resizing Assemblies in Inventor Jeff Waegelin Inventor 7 02-25-2003 12:43 PM


All times are GMT -5. The time now is 11:30 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi