Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

sgl_imaging_challenge_banner_30_second_exp_2_winners.thumb.jpg.b5430b40547c40d344fd4493776ab99f.jpg

HenkSB

OpenCV for the QHY5 on Linux

Recommended Posts

I want to use my QHY5 with OpenCV on the Raspberry Pi.  From what I know so far OpenCV supports v4l2.  So if the QHY5 driver is a v4l2 driver it should work without a problem.  But it does not. 

Looking at the PHD2 code I see that it is used with the plain libusb API, so perhaps the QHY5 driver is a plain USB driver but not a v4l2 driver.  The device is listed as /dev/QHY5 while I suspect it should be /dev/video0 because v4l2 is a video driver.  Yet, I have seen Python code (at http://sy2000.blogspot.com/) that uses the QHY5 with OpenCV happily, unfortunately little was said about the driver. 

Any suggestions?  Thanks in advance.

Share this post


Link to post
Share on other sites

(BUMP!)  Sorry to bump this but maybe I started this thread at the wrong time being not in the mainstream SGL continent.  I noticed a good deal of  Linux/RasPi savvy posts on here so please chime in.  Maybe I should have picked the DIY forum?

Anyway what I found meanwhile is that QHY has published a Linux SDK on git but no source code.  Even then, their API does not seem to have anything to do with v42l or OpenCV.  So I am still puzzled what supports the Python code in that link. 

Any help appreciated, thanks again.

Share this post


Link to post
Share on other sites

Reading that link again there is actually no reference to a QHY5 just "USB camera" so I must have had the links in my head messed up.  Nevertheless if anyone knows an OpenCV or v4l2 driver for QHY5 I would appreciate it.

Share this post


Link to post
Share on other sites

Hi HenkSB,


Did you make any progress here. I'm on the exact same voyage. 


One of the problems with opencv is that you have to twist its arm for a 16 bit imread. There is a flag that you have to set (cv_any_depth or something from memory). Zwo asi120 is much easier, so I may swap out my qhy for zwo if I can't fix it.


Steve.

Share this post


Link to post
Share on other sites

Surely it's just recompiling the OpenCV .. as long as it has a back end for SIMD instructions. There is an OpenCL variant of OpenCV but the issue there is, again, the GPU code needs to be specific for the architecture to get any real performance boost - especially with the shared memory systems on embedded (such as PI and Odroid etc).

 

  • Like 1

Share this post


Link to post
Share on other sites
On 18/11/2017 at 11:17, NickK said:

Surely it's just recompiling the OpenCV .. as long as it has a back end for SIMD instructions. There is an OpenCL variant of OpenCV but the issue there is, again, the GPU code needs to be specific for the architecture to get any real performance boost - especially with the shared memory systems on embedded (such as PI and Odroid etc).

 

I used apt-get, but do you mean wget/make/make install?  Will that link the QHY5 code?

I could try it.

Regards

Steve

Share this post


Link to post
Share on other sites
11 hours ago, SteveBz said:

I used apt-get, but do you mean wget/make/make install?  Will that link the QHY5 code?

I could try it.

 

You may find that you need additional dependencies - sometimes you can apt get the source packages.

Judging by your original post - it sounds like there's a piece of code or a configuration that is needed.

Sometimes drivers installed only detect each other at start up so also worth trying a reboot.

Share this post


Link to post
Share on other sites

Only just seen this.

There are no V4L2 drivers for any of the QHY cameras that I am aware of.  The QHY libraries provide a user-space interface layered on top of libusb and as already noted, they're closed source (pretty much the same case as for the ZWO cameras, to be fair).  The impression I have is that resources for developing the SDK are limited, so they're focusing on specific cameras at the moment.  I'd guess as they're a business those are the ones that are most "interesting" commercially from their point of view.  Getting new V4L2 drivers into the kernel is likely to be quite a time-consuming affair and their code is currently C++ which I believe would need to be converted back to C, so I think it's unlikely they'd ever bother to try.

I've not checked, but I'm not aware that OpenCV supports using the QHY SDK directly to grab frames.

I've written open source drivers for the QHY5, QHY5-II, QHY5L-II and QHY6 that work on Linux and OSX and in the next (imminent) release I've added support for the IMG132E, but again they're layered on top of libusb so there's no V4L2-style interface.  I'll probably add more in the future.  I might even "do requests" as long as I can get hold of a camera to work with, but (for QHY cameras at least) they'll still be using libusb.  Writing a V4L2 kernel driver isn't an itch I feel a desperate need to scratch unless someone else has an itch go give me a large pile of cash to do so :icon_biggrin:

So, that's pretty much where you are...  No V4L2 driver, possibly you can use the QHY SDK and bodge up what you need to make it work with OpenCV as long as it supports the camera you want to use, or you're welcome to take my interface and do the same/use it as you wish (or even just rip out the driver code and use that).

James

  • Like 1

Share this post


Link to post
Share on other sites
On 17/12/2017 at 00:06, JamesF said:

Only just seen this.

There are no V4L2 drivers for any of the QHY cameras that I am aware of.  The QHY libraries provide a user-space interface layered on top of libusb and as already noted, they're closed source (pretty much the same case as for the ZWO cameras, to be fair).  The impression I have is that resources for developing the SDK are limited, so they're focusing on specific cameras at the moment.  I'd guess as they're a business those are the ones that are most "interesting" commercially from their point of view.  Getting new V4L2 drivers into the kernel is likely to be quite a time-consuming affair and their code is currently C++ which I believe would need to be converted back to C, so I think it's unlikely they'd ever bother to try.

I've not checked, but I'm not aware that OpenCV supports using the QHY SDK directly to grab frames.

I've written open source drivers for the QHY5, QHY5-II, QHY5L-II and QHY6 that work on Linux and OSX and in the next (imminent) release I've added support for the IMG132E, but again they're layered on top of libusb so there's no V4L2-style interface.  I'll probably add more in the future.  I might even "do requests" as long as I can get hold of a camera to work with, but (for QHY cameras at least) they'll still be using libusb.  Writing a V4L2 kernel driver isn't an itch I feel a desperate need to scratch unless someone else has an itch go give me a large pile of cash to do so :icon_biggrin:

So, that's pretty much where you are...  No V4L2 driver, possibly you can use the QHY SDK and bodge up what you need to make it work with OpenCV as long as it supports the camera you want to use, or you're welcome to take my interface and do the same/use it as you wish (or even just rip out the driver code and use that).

James

Hi James,

Great answer. Have seen the zwo python interface interface? Do you have a view on it?

I felt if I only needed to grab the occasional frame maybe zwo would be easier.

Regards

Steve.

What do you think?

Share this post


Link to post
Share on other sites

Haven't looked at the Python interface, I have to admit.  Many moons ago I worked as a developer (mostly in C and assembler) for a company whose main business was COBOL development tools.  I've been unable to overcome my aversion to languages dependent upon indentation ever since :D  I recognise that's no fault of Python's.  I don't know why.

Grabbing the occasional frame should certainly be fairly easy with the ZWO cameras and I believe the same sort of thing should work with some of the newer QHY cameras and their SDK too (the QHY5L-II, for instance).  There is also an SDK for the Toupcam cameras which I think could be made to work.

If you want to stick with the V4L2 interface and OpenCV can do all the work then you could also look at some of the USB TIS and Celestron monochrome cameras.  Many are UVC compliant, so are handled by the kernel (colour ones are more tricky though).

James

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By johnb
      Sorry its the old driver issue (I think)
      Im running win 10 and have a QHY 5 II M
      Installed
      QHY5 Driver
      Update
      ASCOM 4 driver
      Camera shows up in Device Manager as: 
      Astroimaging - QHY5II
      Start Sharp Cap and it finds: QHY 5 II M and connects - however if i start to capture there is just a dark screen (given it day time and the camera has plenty of light I would have expected basically a white screen)

      Start QGVideo and it just says No Camera Detected
      Im sure it is a driver issues but I find the info online overwhelming as there is so much
      Pointers really appreciated
      Regards
      John B
    • By OlegKutkov
      Hello.
      This is my first post here and I wish to introduce a little program i wrote.
      This is a RAW to FITS batch converter. Converter supports many cameras vendors: Canon, Nikon, Pentax, Fuji, Konica, Hasselblad and so on.
      May be useful for someone who shooting space with DSLR and wanna do a real science, search for variable stars for example.
      Program is very simple (see attached screenshot), you just set input directory, output directory and few conversion options.
      You can choose how to process color channels from the RAW file.
      Possible options is:
      - convert RGB to avarage grayscale
      - store all three channels as separate images in a one FITS.
      - store all three channels in a separate FITS's
      - store only one selected channel
      Converter supports multithreading conversion, depending on your cpu/cores count.
      All data you entered in UI will store in FITS header. Some data (like exposure, date and camera model) may be acquired from the RAW file, this is preferable.
       
      This is a free software licensed under GPLv2 license.
      You can get it on github: https://github.com/olegkutkov/Raw2Fits
      Program uses libraw library and i highly recommend to get latest stable version of this library instead of using your distro version. If you have multiple LibRaw versions on your system - please carefully check which version you linking and using in runtime. Correct Makefile if needed.
      Libraw version older than 0.17 may not correctly extract EXIF data from the RAW files.
      Also you will need cfitsio, any version is Ok.
      User interface is built with GTK3 toolkit and tested with Gnome 3, Mate and Cinnamon DE on different Mint, Debian and Fedora distributions.
       
      After executing 'sudo make install' command this program should appear in your Applications menu
      Hope this program will be useful for someone.
      I will be glad to hear your feedback, propositions and bug reports



       

    • By jdmgray
      Hi all, 
      Not sure I'm in the right place or not but I was hoping someone could help...
      I have an Altair Astro GPCamV2 and the box tells you to get the software from http://cameras.altairastro.com/ and that it will only work with Windows!
      I was wondering if anyone else has gotten this type of cam working on a Linux os before and what the steps were for doing so. (Other software that will work, terminal commands for the drivers etc.)
      thank you in advance ?
    • By jdmgray
      Hi everyone.
      I'm currently running Linux on my laptop and just wanted to know the best stacking software is for an amateur to use.
      I tried installing registax with wine but it didn't work.
      I've tried out PIPP and didn't really get on with it.
      So far the only one I've gotten my head around is Siril by free astro.
      Would like to know what other software there is that works well on linux that is good for amateurs who have just started playing around with this. 
    • By GuLinux
      Hello,
      I just finished uploading a new beta version (0.7.0-beta1) of my Planetary Imager application.
      One of the biggest news of this release is the availability for all major platforms (although OSX users might struggle a bit..). But of course, we also have a few new interesting features, like a network mode (client and server), a new histogram, and profiles support. Please look the official changelog for more information.
      You can download the packages from the official download page, or grab the sources directly from the github project page
      (edit: reuploaded Windows package, it had a small directory layout issue preventing startup)
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.