Go to Post Dear CNN, We're not from indiana. Love, Wildstang - AlecMataloni [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 25-01-2012, 19:51
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Camera GetImage not getting image

I might suggest a couple things...

Set your resolution, brightness, and compression before getting any images. Shouldn't be some major failure point, but....good practice.

Also, I thought that GetImage returned a ColorImage and while HSLImage is related, I'd give a shot at going to the basics that way.

Otherwise, I might suspect config issues - have you tried NI Vision assistant and is it able to grab images?

Lastly - after looking once again - I would suggest using a standard while(isOperatorControl()) {} and place your if (isFreshImage()) inside there. Remember, this is a realtime gig and while your desktop is faster than the cRio, the cRio is 400MHz and so it'll crank through the camera items very quickly. It is possible that after gaining access to the camera, it isn't ready for you to grab an image. I'd suggest sometime like:

Code:
...OperatorControl() {
int iWidth = 0;
Error &err;
ColorImage *image;	

AxisCamera &m_camera = AxisCamera::GetInstance("10.12.51.11");
m_camera.WriteResolution(AxisCamera::kResolution_3 20x240);
m_camera.WriteCompression(20);
m_camera.WriteBrightness(0);

while (isOperatorControl())
{
  if (m_camera.isFreshImage())
  {
    image = m_camera.GetImage();

    err = m_camera.GetError();	
    if (err.GetLineNumber() != 0)
    {
  // Might this supposed to be err.GetCode() for a code value?
  // Not going to fix the problem - but will be more informative I think.
      printf("AxisCamera error number %f \n", err.GetLineNumber());
      printf(err.GetMessage());
    }
    else
    {
      iWidth = image->GetWidth();
    }

  delete image;
  }
}

return;
}
This will test to make sure that you're REALLY waiting on the camera to become ready and grabbing an image, checking errors, and width etc. If you have are actively debugging, I'd breakpoint on 'iWidth=' line or do a printf() or something to alert yourself that you really did get a valid image at some point.

bob
P.S. This is being typed @ work - no compilers involved. Likely has minor issues or more...
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
 


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


All times are GMT -5. The time now is 17:35.

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


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