Halcon机器视觉论坛

 找回密码
 会员注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1397|回复: 13
收起左侧

[已解决] DirectShow multi camera resolution error

[复制链接]
  • TA的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

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

    部门经理 |主题 12|帖子 52|积分 1525

    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);
    复制代码

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

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

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

  • TA的每日心情
    耍酷
    4 分钟前
  • 签到天数: 637 天

    连续签到: 1 天

    [LV.9]以坛为家II

    353

    主题

    1357

    帖子

    5265

    积分

    Rank: 9

    积分
    5265

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

    发表于 2017-11-9 17:19:50 | 显示全部楼层

    管理员 |主题 353|帖子 1357|积分 5265

    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的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-9 18:04:44 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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 ).

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

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

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

  • TA的每日心情
    耍酷
    4 分钟前
  • 签到天数: 637 天

    连续签到: 1 天

    [LV.9]以坛为家II

    353

    主题

    1357

    帖子

    5265

    积分

    Rank: 9

    积分
    5265

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

    发表于 2017-11-9 21:35:20 | 显示全部楼层

    管理员 |主题 353|帖子 1357|积分 5265

    Maybe your bandwidth isn't enough or lower voltage
    无效附件更新 权限提升操作 删帖申请 举报以及其他需要帮助请加入QQ群:214663141 广告位招商 有意者联系
  • TA的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-10 00:35:58 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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.

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

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

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

  • TA的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-10 04:00:57 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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)'

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

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

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

  • TA的每日心情
    耍酷
    4 分钟前
  • 签到天数: 637 天

    连续签到: 1 天

    [LV.9]以坛为家II

    353

    主题

    1357

    帖子

    5265

    积分

    Rank: 9

    积分
    5265

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

    发表于 2017-11-10 10:52:20 | 显示全部楼层

    管理员 |主题 353|帖子 1357|积分 5265

    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的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-10 13:17:56 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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)
    ***************************************

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

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

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

  • TA的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-10 14:36:45 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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

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

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

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

  • TA的每日心情
    点赞
    2019-6-10 13:06
  • 签到天数: 360 天

    连续签到: 1 天

    [LV.8]以坛为家I

    12

    主题

    52

    帖子

    1525

    积分

    Rank: 4Rank: 4

    积分
    1525

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

     楼主| 发表于 2017-11-12 23:22:13 | 显示全部楼层

    部门经理 |主题 12|帖子 52|积分 1525

    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 下一条

    Halcon鸟叔机器视觉1鸟叔机器视觉 | 51Halcon官方客服咨询官方客服咨询 | Halcon切换助手使用反馈切换助手使用反馈 | 51Halcon论坛管理团队论坛管理团队

    申请友链| 小黑屋| 手机版| Archiver| Halcon机器视觉论坛  

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

    Powered by Discuz! X3.4 Licensed© 2015-2019 Comsenz Inc.

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