I am having a similar problem to the OP. I'm using the below code, a modified version of what bob.wolff68 suggested. Running this function once at the beginning of teleop, I get the image size error on the DS LCD every time. Does anyone know what could be causing this behavior?
Code:
void CameraTest()
{
AxisCamera& pCamera = AxisCamera::GetInstance();
pCamera.WriteResolution(AxisCamera::kResolution_320x240);
pCamera.WriteCompression(20);
pCamera.WriteBrightness(0);
if (true/*pCamera*/) //since pCamera is not a pointer, this wouldn't work...
{
ColorImage* pImage = pCamera.GetImage();
if (pImage)
{
if (pImage->GetHeight() == 0 || pImage->GetWidth()==0)
{
dslcd->PrintfLine(dslcd->kUser_Line4,"Error with image size - height/width is zero.");
dslcd->UpdateLCD();
}
else
{
pImage->Write("Image.jpg");
dslcd->PrintfLine(dslcd->kUser_Line4,"Wrote file out to Image.jpg...should be a success.");
dslcd->UpdateLCD();
}
delete pImage;
}
else
{
dslcd->PrintfLine(dslcd->kUser_Line4,"Image returned by GetImage was NULL. Big error.");
dslcd->UpdateLCD();
}
}
else
{
dslcd->PrintfLine(dslcd->kUser_Line4,"Never got the camera instance. Big error.");
dslcd->UpdateLCD();
}
}
Daniel