element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Vision Thing
  • Challenges & Projects
  • Project14
  • Vision Thing
  • More
  • Cancel
Vision Thing
Forum Installing OpenCV is Like...
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Vision Thing to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 21 replies
  • Answers 17 answers
  • Subscribers 13 subscribers
  • Views 4339 views
  • Users 0 members are here
  • visionthingch
  • bb-ai
  • ibox
  • opencv
  • ai
Related

Installing OpenCV is Like...

14rhb
14rhb over 5 years ago

After several days into attempting to install OpenCV on my BB-AI it feels like I'm at about 0:15s into this video !

image

https://www.youtube.com/watch?v=wmFzGXy5uYc

 

Maybe some pointers for others are in my iBox posts:

iBox: #2 Setting up the BB-AI

iBox: #3 Is it a cat, a plane, a moth?

 

I also tried cross compiling on my faster PC with the aim of porting the code across afterwards, but that too failed with the libpython2-dev:armhf library not being found. After much adjustment of my machine on the Linux command line I'm also no nearer on that approach.

 

But it did make me think, hence this question rather than a blog post:

If I were to compile the OpenCV on my other machine and port it across to the BB-AI then has someone else done this? e.g. why am I sitting waiting days for the BB-AI to run CMAKE if it could be done externally and highly likely someone already has.

 

I've learnt many Linux commands along the way and have a rough understanding of what cross-compiling is.....so progress todate has been worthwhile still image

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 5 years ago +9 verified
    Hi Rod! I can't recall how long it took to compile OpenCV from scratch on a BeagleBone Black, but it's doable (within hours but cannot remember how many!), so BB-AI should work nicely too. If I can make…
  • 14rhb
    14rhb over 5 years ago in reply to shabaz +5 suggested
    Hi Shabaz, Thank you for that good advice and insight into what cross-compiling is about. I'm back on the BB-AI directly, albeit via SSH, and having another go at following the instructions on the OpenCV…
  • shabaz
    shabaz over 5 years ago in reply to 14rhb +5 suggested
    Hi Rod, The 1GByte RAM should be fine (as you say, not running the desktop should speed things up) since the older BBB can compile OpenCV too. Regarding storage, if you've got any existing home NAS (e…
  • shabaz
    0 shabaz over 5 years ago

    Hi Rod!

     

    I can't recall how long it took to compile OpenCV from scratch on a BeagleBone Black, but it's doable (within hours but cannot remember how many!), so BB-AI should work nicely too.

    If I can make a suggestion, it would be to avoid the cross-compiling for now, and do it all directly on the BB-AI. The reason is, cross-compiling is delicate, any slight difference can result in incompatibility of the executable, or absence or incompatibility of dynamically-loaded code.

    Cross-compiling is useful for some use-cases, but just for speed improvements in build time is not so important unless you're doing commercial development (and even then, it's normal for builds to run overnight - not that you need to do that for code the size of OpenCV!).

    A major project I spent several years on (a telco solution), I had to do cross-compiling, until, over the years, the processor speed of the target hardware, (and resources on the target) significantly improved, so that I didn't need cross-compiling speed boost any more. I also benefited from not needing to maintain the cross-compile environment any longer, which was an overhead for a small team (me and my team-leader).

    (I believe the Pi people do the same thing, although I could be wrong - I think I saw some post or comment ages ago that their build server is a bunch of Pi's, and not cross-compiled, although they may have originally cross-compiled in the Pi 1 days).

     

    There could also be other reasons to continue cross-compiling in work environments (e.g. if you cannot get your target hardware approved for installation in the data centre, infosec approval etc) but that won't apply to you.

    Finally, there are cross-compiling benefits where additional PC software tools are being used, or better PC tools are available, but again these don't apply here.

     

    If you're running low on storage then it is worth mounting some extra storage to the BB-AI. I sometimes use my NAS for that. It's not fast, but if you're only compiling OpenCV rarely, then it's not a bad way to go.

    • Cancel
    • Vote Up +9 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • 14rhb
    0 14rhb over 5 years ago in reply to shabaz

    Hi Shabaz,

     

    Thank you for that good advice and insight into what cross-compiling is about.

    I'm back on the BB-AI directly, albeit via SSH, and having another go at following the instructions on the OpenCV website https://docs.opencv.org/4.1.1/d7/d9f/tutorial_linux_install.html

     

    When you mention storage, the BB-AI comes with 1GByte of onboard RAM so I guess you mean adding an SDCard to augment that? I'll have to read about that as my Linux skills are getting pushed on this project (in a good way). I have a 4GByte uSDcard free.

     

    I also have the HDMI plugged in and see there is a Debian desktop up and running. I could probably turn that off somehow and save RAM.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • shabaz
    0 shabaz over 5 years ago in reply to 14rhb

    Hi Rod,

     

    The 1GByte RAM should be fine (as you say, not running the desktop should speed things up) since the older BBB can compile OpenCV too. Regarding storage, if you've got any existing home NAS (e.g. to store movies/photos etc) then sometimes there is an option in there to turn on NFS (network file sharing) and then a mount command (I can dig up the syntax if needed) can be used in Linux so that you can go to (say) /mnt/nas/opencv and put all your files there (this is useful where there's a lot of source code) but a micro SD card should be fine too.

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • vlasov01
    0 vlasov01 over 5 years ago in reply to shabaz

    Hi there,

     

    I've run in out of memory situation during compilation on BB-AI. If you get the same issue, than you will need to create a swap.space. I was following the following document: https://linuxize.com/post/how-to-add-swap-space-on-debian-9/  to accomplish it..

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • 14rhb
    0 14rhb over 5 years ago in reply to vlasov01

    Hi vlasov01 thank you for this help comment. Do you know what error messages would indicate running out of memory? My compilation often hangs at various points or throws an error but does actually mention a RAM shortage.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • vlasov01
    0 vlasov01 over 5 years ago in reply to 14rhb

    Hi Rod,

     

    I was running dmesg when I realized that the build process run out of memory and got killed. I don't remember exact message so. If I got one again I'll let you know.

     

    Sergey

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • fyaocn
    0 fyaocn over 5 years ago

    in fact,you can find opencv2 on B.B. Ai already.

    If you really need opencv 4.1, build from sources then.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • clem57
    0 clem57 over 5 years ago in reply to fyaocn

    fyaocn  wrote:

     

    in fact,you can find opencv2 on B.B. Ai already.

    If you really need opencv 4.1, build from sources then.

    So use opencv2 instead of opencv?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • 14rhb
    0 14rhb over 5 years ago in reply to fyaocn

    This is most helpful, thank you. I naturally assumed to go for the latest version (4.1.1) and didn't think to look back.

     

    Are you saying OpenCV2 is already installed as part of the build?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • clem57
    0 clem57 over 5 years ago in reply to 14rhb

    Have not looked, but it seems to be. Can you confirm?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube