51Halcon机器视觉

 找回密码
 会员注册

QQ登录

只需一步,快速开始

扫一扫,微信登录

查看: 2615|回复: 13

[已解决] DirectShow multi camera resolution error

[复制链接]
  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

    发表于 2017-11-9 16:35:45 | 显示全部楼层 |阅读模式

    51Halcon诚邀您的加入,专注于机器视觉开发与应用技术,我们一直都在努力!

    您需要 登录 才可以下载或查看,没有帐号?会员注册

    x
    I will use a webcam camera like Logitech c920. It supports "2304x1536" resolution. I used it succesfully for single camera. But when I use two cameras(2304x1536) , second camera is connecting and it failed 2-3 seconds later. (capture timeout error).

    Also, when I set cameras resolution to (1920x1080), they are working well. According to me, Two cameras which are setting to (2304x1536 resolution) , aren't working at same time. Why doesn't it work well for multi cameras?

    Thanks.

    My codes:
    1. HTuple AcqHandle1, AcqHandle2;
    2. HObject Image1, Image2;

    3. HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb", -1, "false", "[0] RGB24 (" + "2304x1536" + ")", "[0] Logitech HD Pro Webcam C920", 0, -1, out AcqHandle1);
    4. HOperatorSet.GrabImageStart(AcqHandle1, -1);
    5. Thread.Sleep(3000);// wait seconds
    6. HOperatorSet.GrabImageAsync(out Image1 , AcqHandle1 , -1);

    7. HOperatorSet.OpenFramegrabber("DirectShow", 1, 1, 0, 0, 0, 0, "default", 8, "rgb", -1, "false", "[0] RGB24 (" + "2304x1536" + ")", "[1] Logitech HD Pro Webcam C920", 0, -1, out AcqHandle2);
    8. HOperatorSet.GrabImageStart(AcqHandle2, -1);

    9. Thread.Sleep(3000);// wait seconds
    10. HOperatorSet.GrabImageAsync(out Image2, AcqHandle2, -1);
    复制代码

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    点赞
    前天 09:50
  • 签到天数: 975 天

    连续签到: 11 天

    [LV.10]以坛为家III

    382

    主题

    1559

    帖子

    7390

    积分

    Rank: 9

    积分
    7390

    突出贡献优秀版主荣誉管理论坛元老切换助手验证会员最佳新人

    发表于 2017-11-9 17:19:50 | 显示全部楼层
    maybe your workstation is not supported by two cameras.  capture codes:
    1. HOperatorSet.GrabImageAsync(out Image1 , AcqHandle1 , -1);
    复制代码
    try  to made it  like:
    1. HOperatorSet.GrabImage(out Image1 , AcqHandle1);
    复制代码


    无效附件更新 权限提升操作 删帖申请 举报以及其他需要帮助请加入QQ群:214663141 广告位招商 有意者联系
  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-9 18:04:44 | 显示全部楼层
    I tried it but nothing changed. There is a led on webcam. It lights when run this command(HOperatorSet.GrabImageStart (AcqHandle1, -1);). When I run it for second camera, led is lighting 2-3 seconds and its status is been off later. And after, I ran this command ("HOperatorSet.GrabImage (outImage2, AcqHandle2);") , it failed to timeout error.

    Note: My Workstation isn't running any problem by two cameras with (1920x1080 and below resolution ).

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    点赞
    前天 09:50
  • 签到天数: 975 天

    连续签到: 11 天

    [LV.10]以坛为家III

    382

    主题

    1559

    帖子

    7390

    积分

    Rank: 9

    积分
    7390

    突出贡献优秀版主荣誉管理论坛元老切换助手验证会员最佳新人

    发表于 2017-11-9 21:35:20 | 显示全部楼层
    Maybe your bandwidth isn't enough or lower voltage
    无效附件更新 权限提升操作 删帖申请 举报以及其他需要帮助请加入QQ群:214663141 广告位招商 有意者联系
  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-10 00:35:58 | 显示全部楼层
    I tried it with usb 3.0 hub (external power - 5v 6A). So, I think, this problem is not related to lower voltage.
    Is USB3.0 enough for bandwith or how can I research it?

    At this time, It is working well sometimes.(2 cameras - 2304x1536 resolution) But It is not working generally.

    For example, it is running well(2 cameras - 2304x1536).(Visual studio debug mode.) After, I closed visual studio and reopen. But it is not working this time. :'(  It is boring.

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-10 04:00:57 | 显示全部楼层
    And I tried example which is shown below.

    Halcon example => "directshow_2cameras.hdev"

    In example:

    // Working well
    MyCameraType1 := 'default'
    MyCameraType2 := 'default'

    // Working well
    MyCameraType1 := 'RGB24 (2304X1536)'
    MyCameraType2 := 'default'

    // Working well
    MyCameraType1 := 'default'
    MyCameraType2 := 'RGB24 (2304X1536)'

    // first camera is woking well, but second camera isn't working. (sometimes both of them are working :L)
    // everytime fist camera OK.
    MyCameraType1 := 'RGB24 (2304X1536)'
    MyCameraType2 := 'RGB24 (2304X1536)'

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    点赞
    前天 09:50
  • 签到天数: 975 天

    连续签到: 11 天

    [LV.10]以坛为家III

    382

    主题

    1559

    帖子

    7390

    积分

    Rank: 9

    积分
    7390

    突出贡献优秀版主荣誉管理论坛元老切换助手验证会员最佳新人

    发表于 2017-11-10 10:52:20 | 显示全部楼层
    Which halcon version  do  you used? I can't found anything about example like "directshow_2cameras.hdev"

    your hub's bandwidth must be shared! you can use a pc with PCI-E usb card! or reduce the framerate!
    无效附件更新 权限提升操作 删帖申请 举报以及其他需要帮助请加入QQ群:214663141 广告位招商 有意者联系
  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-10 13:17:56 | 显示全部楼层
    I use version-13.0.  The example is shown below.


    ***************************************
    *
    * Example for the usage of a DirectShow compatible capture device
    * (grabbing from two devices)
    *
    *
    dev_update_off ()
    info_framegrabber ('DirectShow', 'general', GeneralInfo, GeneralInfoValues)
    info_framegrabber ('DirectShow', 'revision', RevInfo, RevInfoValues)
    *
    * Check your installed camera devices:
    info_framegrabber ('DirectShow', 'camera_types', CameraTypeInfo, CameraTypeInfoValues)
    info_framegrabber ('DirectShow', 'info_boards', BoardInfo, BoardInfoValues)
    *
    * Check for the proper CameraType, Device, and Port settings
    * (see output of info_framegrabber(..,'info_boards',..))
    MyCameraType1 := 'default'
    * MyCameraType1 := 'RGB24 (640x480)'
    MyCameraType2 := 'default'
    * MyCameraType2 := 'RGB24 (640x480)'
    MyDevice1 := '0'
    MyDevice2 := '1'
    MyPort1 := -1
    MyPort2 := -1
    *
    open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', -1, 'gray', -1, 'false', MyCameraType1, MyDevice1, MyPort1, -1, AcqHandle1)
    open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', -1, 'gray', -1, 'false', MyCameraType2, MyDevice2, MyPort2, -1, AcqHandle2)
    *
    * Query current settings:
    get_framegrabber_param (AcqHandle1, ['camera_type','frame_rate'], CurrentSettings1)
    get_framegrabber_param (AcqHandle2, ['camera_type','frame_rate'], CurrentSettings2)
    *
    grab_image (Image1, AcqHandle1)
    grab_image (Image2, AcqHandle2)
    get_image_size (Image1, Width1, Height1)
    get_image_size (Image2, Width2, Height2)
    dev_close_window ()
    dev_close_window ()
    dev_open_window (0, 0, Width1 / 2, Height1 / 2, 'black', WindowHandle1)
    dev_open_window (0, Width1 / 2 + 20, Width2 / 2, Height2 / 2, 'black', WindowHandle2)
    *
    count_seconds (SecondsOld)
    while (1)
        grab_image (Image1, AcqHandle1)
        dev_set_window (WindowHandle1)
        dev_display (Image1)
        grab_image (Image2, AcqHandle2)
        dev_set_window (WindowHandle2)
        dev_display (Image2)
        count_seconds (SecondsNew)
        FrameRate := 1 / (SecondsNew - SecondsOld)
        SecondsOld := SecondsNew
    endwhile
    *
    close_framegrabber (AcqHandle1)
    close_framegrabber (AcqHandle2)
    ***************************************

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-10 14:36:45 | 显示全部楼层
    And I tried it which is shown on below. it is working well.

    Is reason of problem based on bandwith problem certainly?


    1. start first camera
    2. capture from first camera
    3. stop first camera

    4. start second camera
    5. capture from second camera
    6. stop second camera


    while (true)
    open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'RGB24 (2304x1536)', '[0] Logitech HD Pro Webcam C920', 0, -1, AcqHandle)
    grab_image_start (AcqHandle, -1)
        dev_set_window (WindowHandle1)
        grab_image_async (Image, AcqHandle, -1)
        dev_display (Image)
    close_framegrabber (AcqHandle)
       



    open_framegrabber ('DirectShow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'RGB24 (2304x1536)', '[1] Logitech HD Pro Webcam C920', 0, -1, AcqHandle2)
    grab_image_start (AcqHandle2, -1)
        dev_set_window (WindowHandle2)
        grab_image_async (Image2, AcqHandle2, -1)
        dev_display (Image2)
    close_framegrabber (AcqHandle2)
       
    endwhile

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

  • TA的每日心情
    开心
    2020-9-25 14:09
  • 签到天数: 377 天

    连续签到: 2 天

    [LV.9]以坛为家II

    12

    主题

    56

    帖子

    1579

    积分

    Rank: 4Rank: 4

    积分
    1579

    活跃会员切换助手验证会员

     楼主| 发表于 2017-11-12 23:22:13 | 显示全部楼层
    I resolved the problem. I tried it with a computer which has more performance , and it is working well now.
    According to me, the problem was about with mainboard performance.
    Thanks for your information.

    1.发帖求助前要善用论坛搜索功能,那里可能会有你要找的答案;

    2.提问请组织好自己的逻辑,标题注明大概是什么问题,问题内容写详细,需提供问题症状、错误代码、截图、位置等等信息,不要让别人去猜你想问啥;

    3.如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子分类或者标题前面加上【已解决】

    4.回报帮助你解决问题的坛友,右下角【免费评分】赠与对方视觉币和热心值,伸手党遭人唾弃,做一个热心并受欢迎的人!

    您需要登录后才可以回帖 会员登录 | 会员注册

    本版积分规则

    建议您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流浏览器浏览本网站

    51Halcon会员技术交流会员技术交流 | 51Halcon官方客服咨询官方客服咨询 | Halcon切换助手使用反馈切换助手使用

    有问题需要咨询站长?| 申请友链| 小黑屋| 手机版| Archiver|  

    粤ICP备15095995号-2 粤公网安备44030602000670号

    CopyRight © 2015-2020 51Halcon机器视觉. Tencent Cloud X3.4.

    快速回复 返回顶部 返回列表