更新固件\SDK后无法在PTGRey相机(Dragonflyexpress)上开始捕获
我使用 Point Grey Research 的 Dragonfly Express 相机已有几个月了。 我已经编写了使用相机并用它抓取图像的代码。 最近我将固件和 SDK 从 2 更新到了 2.2,从那时起我无法使用我的代码抓取图像。新的 FlyCapture2 控制面板(2.2)可以工作并且能够使用同一相机捕获视频。 具体来说,当我对 Camera 对象调用 StartCapture 时,出现错误。我正在粘贴程序的输出,然后添加相关的相机代码:
* CAMERA INFORMATION * 序列号 - 7340769 相机型号-蜻蜓快车DX-BW 相机供应商 - Point Grey Research 传感器 - 柯达 KAI-0340DM (1/3" 640x480 CCD) 分辨率 - 648x484 固件版本 - 1.1.1.21 固件构建时间 - 2006 年 6 月 21 日星期三 23:01:00
错误跟踪: 来源:.\IidcCameraInternal.cpp(429) 构建:2010 年 9 月 23 日 12:41:46 - 错误启动 ng 等时流。 +->来自:.\Iso.cpp(1515) 构建:2010 年 9 月 23 日 12:41:43 - 同步启动失败 。错误:0x15。
bool
Camera::Start()
{
FlyCapture2::BusManager busMgr;
unsigned int numCameras;
error = busMgr.GetNumOfCameras(&numCameras);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::PGRGuid guid;
{
error = busMgr.GetCameraFromIndex(0, &guid);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
// Connect to a camera
error = cam.Connect(&guid);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
// Get the camera information
FlyCapture2::CameraInfo camInfo;
error = cam.GetCameraInfo(&camInfo);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::FC2Config Config;
FlyCapture2::TriggerDelay Trigger;
cam.GetTriggerDelay (&Trigger);
Trigger.absValue = 0.000075;
Trigger.onOff = true;
error = cam.SetTriggerDelay (&Trigger);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::StrobeControl s;
{
FlyCapture2::TriggerMode Mode;
memset (&Mode, 0, sizeof(Mode));
Mode.source = 0;
error = cam.GetTriggerMode (&Mode);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
Mode.mode = 14;
Mode.onOff = true;
Mode.polarity = 1;
error = cam.SetTriggerMode (&Mode);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
{
FlyCapture2::Property p;
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::AUTO_EXPOSURE;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::BRIGHTNESS;
p.absControl = true;
p.absValue = Brightness;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::SHUTTER;
p.absControl = true;
p.absValue = Shutter;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::GAIN;
p.absControl = true;
p.absValue = Gain;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
bool IsStandard = false;
{
error = cam.SetVideoModeAndFrameRate (FlyCapture2::VideoMode::VIDEOMODE_640x480Y8, FlyCapture2::FRAMERATE_60 );
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::Format7ImageSettings f7;
memset (&f7, 0, sizeof(f7));
f7.mode = FlyCapture2::MODE_0;
float Percent = 1;
f7.mode = FlyCapture2::MODE_0;
f7.height = h;
f7.width = w;
f7.offsetX = 4+((640-w)/2);
f7.offsetY = 2+((480-h)/2);
f7.pixelFormat = FlyCapture2::PIXEL_FORMAT_MONO8;
Percent = 100;
bool Valid = false;
FlyCapture2::Format7PacketInfo Info;
error = cam.ValidateFormat7Settings (&f7, &Valid, &Info);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
error = cam.SetFormat7Configuration (&f7, Info.recommendedBytesPerPacket);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
}
cam.GetConfiguration ( &Config);
Config.grabTimeout = 4000;
Config.numBuffers = 120;
Config.grabMode = FlyCapture2::BUFFER_FRAMES;
error = cam.SetConfiguration ( &Config);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
PrintCameraInfo(&camInfo);
// Start capturing images
error = cam.StartCapture();
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
I have been using a Dragonfly Express camera from Point Grey Research for a few months.
I have written code to use the camera and grab images with it.
Lately I have updated the firmware and SDK from 2 to 2.2, since then I was unable to grab images using my code. The new FlyCapture2 control panel(2.2) works and is able to capture video using the same camera.
Specifically, I am getting an error when I call StartCapture on the Camera object. I am pasting the output from my program, and I will add the relevant camera code afterwards:
* CAMERA INFORMATION *
Serial number - 7340769
Camera model - Dragonfly Express DX-BW
Camera vendor - Point Grey Research
Sensor - Kodak KAI-0340DM (1/3" 640x480 CCD)
Resolution - 648x484
Firmware version - 1.1.1.21
Firmware build time - Wed Jun 21 23:01:00 2006
Error Trace:
Source: .\IidcCameraInternal.cpp(429) Built: Sep 23 2010 12:41:46 - Error starti
ng isochronous stream.
+-> From: .\Iso.cpp(1515) Built: Sep 23 2010 12:41:43 - Failed isochronous start
. Error: 0x15.
bool
Camera::Start()
{
FlyCapture2::BusManager busMgr;
unsigned int numCameras;
error = busMgr.GetNumOfCameras(&numCameras);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::PGRGuid guid;
{
error = busMgr.GetCameraFromIndex(0, &guid);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
// Connect to a camera
error = cam.Connect(&guid);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
// Get the camera information
FlyCapture2::CameraInfo camInfo;
error = cam.GetCameraInfo(&camInfo);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::FC2Config Config;
FlyCapture2::TriggerDelay Trigger;
cam.GetTriggerDelay (&Trigger);
Trigger.absValue = 0.000075;
Trigger.onOff = true;
error = cam.SetTriggerDelay (&Trigger);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::StrobeControl s;
{
FlyCapture2::TriggerMode Mode;
memset (&Mode, 0, sizeof(Mode));
Mode.source = 0;
error = cam.GetTriggerMode (&Mode);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
Mode.mode = 14;
Mode.onOff = true;
Mode.polarity = 1;
error = cam.SetTriggerMode (&Mode);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
{
FlyCapture2::Property p;
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::AUTO_EXPOSURE;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::BRIGHTNESS;
p.absControl = true;
p.absValue = Brightness;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::SHUTTER;
p.absControl = true;
p.absValue = Shutter;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
memset (&p, 0, sizeof(p));
p.type = FlyCapture2::GAIN;
p.absControl = true;
p.absValue = Gain;
p.onOff = false;
error = cam.SetProperty (&p);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
bool IsStandard = false;
{
error = cam.SetVideoModeAndFrameRate (FlyCapture2::VideoMode::VIDEOMODE_640x480Y8, FlyCapture2::FRAMERATE_60 );
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
FlyCapture2::Format7ImageSettings f7;
memset (&f7, 0, sizeof(f7));
f7.mode = FlyCapture2::MODE_0;
float Percent = 1;
f7.mode = FlyCapture2::MODE_0;
f7.height = h;
f7.width = w;
f7.offsetX = 4+((640-w)/2);
f7.offsetY = 2+((480-h)/2);
f7.pixelFormat = FlyCapture2::PIXEL_FORMAT_MONO8;
Percent = 100;
bool Valid = false;
FlyCapture2::Format7PacketInfo Info;
error = cam.ValidateFormat7Settings (&f7, &Valid, &Info);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
error = cam.SetFormat7Configuration (&f7, Info.recommendedBytesPerPacket);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
}
cam.GetConfiguration ( &Config);
Config.grabTimeout = 4000;
Config.numBuffers = 120;
Config.grabMode = FlyCapture2::BUFFER_FRAMES;
error = cam.SetConfiguration ( &Config);
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
PrintCameraInfo(&camInfo);
// Start capturing images
error = cam.StartCapture();
if (error != FlyCapture2::PGRERROR_OK)
{
error.PrintErrorTrace();
return false;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
刚刚看到 AndyUK 的第 4 点,不确定这是否对原始海报有帮助。我需要一些有关返回的错误的附加信息。要获得用于设置格式 7 的更通用代码,您需要查询相机的可用步长。每个模型(以及可能的固件版本)将支持偏移的步长和图像大小的步长。指定的偏移量和大小必须是这些步长值的倍数。如果您使用 Camera.GetFormat7Info() 提取信息,相关字段为 offsetHStepSize、offsetVStepSize、imageHStepSize 和 imageVStepSize。我不确定,但听起来 AndyUK 的 Flea2 模型的值是 8, 2, 8, 2。偏移量和图像大小步骤不一定相同,尽管这很常见。
Just saw AndyUK's point 4, not sure if this will help the original poster though. I would need some additional information about the error that's returned. To have more general code for setting format 7 you'll want to query the available step sizes from the camera. Each model (and potentially firmware version) will support a step size for offsets and and a step size for image size. The offset and size specified must be a multiple of these step values. If you pull the info with Camera.GetFormat7Info() the relevant fields are offsetHStepSize, offsetVStepSize, imageHStepSize, and imageVStepSize. I'm not sure but it sounds like the values for AndyUK's Flea2 model would be 8, 2, 8, 2. The offset and image size steps are not necessarily the same although that's common.
只需澄清一两件事:
它是否不断执行此操作,即使您断电并重新启动、拔掉火线等?
您是否尝试过运行安装时附带的 Point Gray 提供的 FlyCapture2 SDK 示例?无论固件/SDK 更新如何,它们仍然可以正常运行吗?您似乎正在利用外部硬件触发器,因此您是否尝试过例如 AsynchTriggerEx 示例,并且当您为其提供软件触发器或外部硬件触发器时,该示例仍然运行良好?或者尝试使用 FlyCap2MFC.exe 示例只是为了检查它是否仍然可以捕获视频?
当您逐行单步执行代码时会发生什么?当它进入 Start() 时,您知道问题是从哪一点开始的吗?在什么情况下,库返回的“错误”值是不需要的值,即不是每个相机函数应返回的 PGRERROR_OK 值?
当我在 Format7(部分图像)模式下使用 Flea2 相机时,对于 MONO8 模式下的图像,我注意到在设置 Format7ImageSettings 结构的宽度时,除非该值是 8 的倍数 em> 对于我的特定应用程序,ValidateFormat7Settings 将返回 FlyCapture2::Error 值 PGRERROR_IIDC_FAILED。同样,高度值也需要是 2 的倍数(偶数)以确保令人满意的 Format7 设置。此错误会导致 cam.StartCapture() 函数挂起。
我不知道最后一点是否已经记录在格雷点文献中,但这只是一个观察。我可能在第 4 点上弄错了。我仍然是 FlyCapture 的新手,还没有完全理解所有内容。我很高兴有机会直接讨论这个问题。
关于最后一点的更多信息请此处。
Just one or two things to clarify:
Is it doing this constantly, even if you power down and restart, unplug the firewire etc?
Have you tried running the FlyCapture2 SDK examples provided by Point Gray that come with your installation? Do they still run fine regardless of the firmware / SDK updates? You appear to be utilizing external hardware triggers so have you tried for example the AsynchTriggerEx example and this still runs fine when you feed it software triggers or external hardware triggers? Or maybe tried the FlyCap2MFC.exe example just to check that it still captures video OK?
What happens when you step though the code line-by-line? When it enters Start() do you know at which point the trouble starts? At what point is the value of "error" returned by the library an undesirable one i.e. not the PGRERROR_OK value each camera function should be returning?
When I've used a Flea2 camera in Format7 (partial image) mode, for images in MONO8 mode, I noticed than when setting the width for the Format7ImageSettings struct, unless this value is a multiple of 8 for my particular application then ValidateFormat7Settings would return the FlyCapture2::Error value PGRERROR_IIDC_FAILED. Similarly the height values also needed to be multiple of 2 (even) to ensure a satisfactory Format7 setting. This error would cause the cam.StartCapture() function to hang.
I don't know if that last point is already documented in the Point Grey literature, but just an observation. I might be mistaken on point 4. I am still a novice in FlyCapture and don't fully understand all of it yet. I would welcome the chance to be put straight on this.
More on that last point here.