Mil 中 不同相机、不同DCF,在同一个digitizer中采集图像

        如果有A和B共两个相机,只有一个digitizer,一般情况下,要用一个DCF分配一个digitizer,然后采集一帧图像,再释放digitizer, 然后再用第二个DCF来分配一个digitizer,采集一帧图像,如此循环。这种情况下是很费时间的。 mil可以通过快速切换技术规避这个问题。

        一般,黑白模拟信号相机有两个格式: CCIR和RS170,图像采集卡一般两种都支持;这种图像采集卡包括:

the Matrox Meteor-II,  Meteor-II/MC, Matrox Corona-II, Matrox CronosPlus and Matrox Orion

令RS170的相机使用channel0, CCIR的相机使用 channnel 1,在循环中这两个通道快速切换,达到两个相机几乎同时采集同时显示图像的效果。示例代码如下:

 

#include "stdafx.h"
#include <conio.h> 
#include <mil.h>


/* Image scale. */
#define IMAGE_SCALE        0.5

void main(void)
{ 
   MIL_ID   MilApplication;
   MIL_ID   MilSystem;
   MIL_ID   MilDigitizerRs170;
   MIL_ID   MilDigitizerCcir;
   MIL_ID   MilImageRs170;
   MIL_ID   MilImageCcir;
   MIL_ID   MilDisplayRs170;
   MIL_ID   MilDisplayCcir;
   double   Time;
   long     NbGrab = 0;
   long     BoardType;

   /* Allocate defaults. */
   MappAlloc(M_DEFAULT, &MilApplication);
   MsysAlloc(M_SYSTEM_METEOR_II, M_DEV0, M_DEFAULT, &MilSystem);

   /* Check if this example is supported on the allocated system. */
   BoardType = MsysInquire(MilSystem, M_BOARD_TYPE, M_NULL);
   if ( (BoardType != M_METEOR_II)           &&
        (BoardType != M_METEOR_II_MC)        &&
        (BoardType != M_ORION)               &&
        (BoardType != M_CORONA_II)           &&
        (BoardType != M_CORONA_II_WITH_DIG_MODULE))
      {
      printf("\nSorry this example is not supported on the allocated system.\n");
      printf("\nSupported boards are:\n");
      printf("Matrox Meteor-II.\n");
      printf("Matrox Meteor-II/MC.\n");
      printf("Matrox Corona-II.\n");
      printf("Matrox CronosPlus.\n");
      printf("Matrox Orion.\n");
      printf("Matrox Orion for 4Sight-II.\n");
      MsysFree(MilSystem);
      MappFree(MilApplication);
      return;
      }

   printf("\nThis example shows how to grab from multiple\n");
   printf("cameras with different DCFs.\n");
   printf("\nBe sure you have a RS170 camera on channel 0 and\n");
   printf("an a CCIR camera on channel 1.\n\n");
   printf("Press Enter to begin.\n");
   getchar();

   /* Allocate multiple digitizers on M_DEV0 with different DCFs.*/
   MdigAlloc(MilSystem, M_DEV0, MIL_TEXT("M_RS170"), M_DEFAULT, &MilDigitizerRs170);
   MdigAlloc(MilSystem, M_DEV0, MIL_TEXT("M_CCIR"), M_DEFAULT, &MilDigitizerCcir);

   /* A history of all calls to MdigControl, MdigChannel, MdigReference and 
      MdigHookFunction are maintained for each allocated digitizer. It is 
      therefore not necessary to redo these calls after a digitizer context
      switch, the restore is done automatically by the driver. */
   MdigControl(MilDigitizerRs170, M_GRAB_SCALE, IMAGE_SCALE);

   /* Enable camera lock, this is done to make shure we are locked on the new
      camera signal after a digitizer context switch.
      Note: changing M_CAMERA_LOCK_SENSITIVITY, and M_CAMERA_UNLOCK_SENSITIVITY
      will affect frame rate performance and grab stability, The user should
      be aware that he may need to change these values for his specific camera
      combination. A lower value of lock and unlock sentivity gives a higher locking/
      unlocking speed but might result in grab sync-lost error messages. */

   MdigControl(MilDigitizerRs170, M_CAMERA_LOCK, M_ENABLE);
   MdigControl(MilDigitizerRs170, M_CAMERA_LOCK_SENSITIVITY, M_DEFAULT);
   MdigControl(MilDigitizerRs170, M_CAMERA_UNLOCK_SENSITIVITY, M_DEFAULT);
   MdigChannel(MilDigitizerRs170, M_CH0);

   MdigControl(MilDigitizerCcir, M_GRAB_SCALE, IMAGE_SCALE);
   MdigControl(MilDigitizerCcir, M_CAMERA_LOCK, M_ENABLE);
   MdigControl(MilDigitizerCcir, M_CAMERA_LOCK_SENSITIVITY, M_DEFAULT);
   MdigControl(MilDigitizerCcir, M_CAMERA_UNLOCK_SENSITIVITY, M_DEFAULT);
   MdigChannel(MilDigitizerCcir, M_CH1);

   MbufAllocColor(MilSystem,
                  (long)MdigInquire(MilDigitizerRs170, M_SIZE_BAND, M_NULL),
                  (long)(MdigInquire(MilDigitizerRs170, M_SIZE_X, M_NULL)*IMAGE_SCALE),
                  (long)(MdigInquire(MilDigitizerRs170, M_SIZE_Y, M_NULL)*IMAGE_SCALE),
                  8L+M_UNSIGNED, 
                  M_IMAGE+M_GRAB+M_DISP,
                  &MilImageRs170);
   MbufAllocColor(MilSystem,
                  (long)MdigInquire(MilDigitizerCcir, M_SIZE_BAND, M_NULL),
                  (long)(MdigInquire(MilDigitizerCcir, M_SIZE_X, M_NULL)*IMAGE_SCALE),
                  (long)(MdigInquire(MilDigitizerCcir, M_SIZE_Y, M_NULL)*IMAGE_SCALE),
                  8L+M_UNSIGNED, 
                  M_IMAGE+M_GRAB+M_DISP,
                  &MilImageCcir);
   MbufClear(MilImageRs170, 128L);
   MbufClear(MilImageCcir, 128L);

   MdispAlloc(MilSystem, M_DEFAULT, M_DEF_DISPLAY_FORMAT, M_DEFAULT, &MilDisplayRs170);
   MdispAlloc(MilSystem, M_DEFAULT, M_DEF_DISPLAY_FORMAT, M_DEFAULT, &MilDisplayCcir);
   MdispControl(MilDisplayRs170, M_WINDOW_TITLE_NAME, (long)MIL_TEXT("Rs170 Display"));
   MdispControl(MilDisplayCcir,  M_WINDOW_TITLE_NAME, (long)MIL_TEXT("Ccir Display"));
   MdispSelect(MilDisplayRs170, MilImageRs170);
   MdispSelect(MilDisplayCcir,  MilImageCcir);

   MappTimer(M_TIMER_RESET, M_NULL);
   while(!kbhit())//等待键盘输入
      {
      /* Here a digitizer context switch is made at every loop:
         the new digitizer state is restored along with all controls. */
      /* Note: For faster digitizer switching time the user should
               create custom DCF's with the channel already selected,
               the user should also remove the call to MdigChannel
               at the initialisation phase of this example. You can
               create these DCF's using Matrox Intellicam. */
      if((NbGrab % 2) == 0)
         MdigGrab(MilDigitizerRs170, MilImageRs170);
      else
         MdigGrab(MilDigitizerCcir, MilImageCcir);

      NbGrab++;
      if((NbGrab % 30) == 0)
         {
         MappTimer(M_TIMER_READ, &Time);
         printf("\r%d\tframes grabbed at %f fps.", NbGrab, 30/Time);
         MappTimer(M_TIMER_RESET, M_NULL);
         }
      }
   getchar();

   /* Free all allocated buffers. */
   MdispFree(MilDisplayRs170);
   MdispFree(MilDisplayCcir);
   MdigFree(MilDigitizerRs170);
   MdigFree(MilDigitizerCcir);
   MbufFree(MilImageRs170);
   MbufFree(MilImageCcir);

   MsysFree(MilSystem);
   MappFree(MilApplication);

   return;
} 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: GetData Graph Digitizer 是一种图形数字化软件,它可以将图形数据从图像文件转换为数值数据。使用 GetData Graph Digitizer,用户可以将图片的坐标轴和数据点识别并提取出来,并将其保存为数据文件,以便进一步分析和处理。 GetData Graph Digitizer 具有简单易用的界面和强大的功能,用户只需导入一个已包含图形的图像文件,然后使用该软件的工具来标记数据点和坐标轴。该软件会自动识别并提取数据点的位置和数值,并根据坐标轴上的标记确定数据的数值范围。 GetData Graph Digitizer 可以处理各种类型的图形,包括曲线图、条形图、散点图等,并支持多种图像文件格式,如PNG、JPEG、BMP等。用户可以根据需要选择合适的图形文件和导入方法。 GetData Graph Digitizer 的应用领域非常广泛。科学研究人员可以使用该软件将实验结果的图形数据提取出来,以便进行统计分析和建模。在工程领域,该软件可以用于测量和分析各种工程图形的数值数据。此外,GetData Graph Digitizer 还可以用于学术研究、数据分析、质量控制等领域。 总之,GetData Graph Digitizer 是一款方便实用的图形数字化工具,它可以帮助用户将图形数据转换为数值数据,并且在各个领域都有很大的应用价值。 ### 回答2: GetData Graph Digitizer是一款数据图表数字化软件。它的主要功能是将已有的图形资料转化为数字形式,方便用户进行数据分析和处理。 使用GetData Graph Digitizer,用户可以选择要数字化的图形,然后通过标记数据点的方式,将图表上的点转化为数字数据。软件提供了强大的图形识别及处理功能,可以自动检测曲线、直线和柱状图等不同类型的图形,并精确地将其数字化。 该软件还具备多种数据导入导出方式,用户可以将数字化后的数据以各种常见格式(如CSV、Excel等)保存,并可根据需要进行进一步的数据处理或导入其他分析软件进行分析。 除了数字化已有的图形外,GetData Graph Digitizer还提供了数据反数字化功能,即根据已有的数值数据,生成相应的图表。在科学研究、工程设计和数据分析等领域,这个功能非常实用,可帮助用户更直观地观察和分析数据。 总之,GetData Graph Digitizer是一个功能强大的数据图表数字化软件,能够帮助用户将图形数据转化为数字形式,方便进行进一步的数据分析和处理。无论是科研人员、工程师、学生还是数据分析师,都可以通过该软件轻松地获取数字化的数据,并在其基础上开展各类工作。 ### 回答3: GetData Graph Digitizer是一款用于将图形数据数字化的软件。该软件可以将印刷品、照片和扫描图像的图表转换为可编辑的数据,方便用户进行进一步分析和处理。 使用GetData Graph Digitizer非常简单方便。首先,用户需要导入包含图表的图像文件。然后,软件会自动识别图表并提供一些工具,帮助用户选择图表的数据点。用户只需简单地点击图表的数据点,软件就会自动将其识别并转换为相应的数字数据。 GetData Graph Digitizer提供了多种数据导出选项。用户可以选择将数字化的数据导出为各种文件格式,例如Excel、CSV、XML等。这样,用户就可以方便地将数据导入到其他数据处理工具,进行进一步分析和处理。 该软件还提供了一些额外的功能,使用户可以进一步完善数字化的数据。例如,用户可以添加标签、单位和注释,以便更好地理解和解释数据。用户还可以进行数据过滤和平滑处理,以去除不必要的噪声和波动。 总之,GetData Graph Digitizer是一款实用的软件工具,具有准确、快捷、易用的特点。它为用户提供了一种简单而高效的方法,将图形数据转换为可编辑的数字数据,方便用户进行数据分析和处理。无论是学术研究、统计分析还是行业应用,这款软件都能发挥出色的作用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值