Easy Python programming sample for USB2 camera shield

Published by vk4tnt on

Home Forums Arducam USB Camera Shields Easy Python programming sample for USB2 camera shield

Viewing 12 reply threads
  • Author
    Posts
    • #27268
      vk4tnt
      Participant

      Hi there,
      I have a MT9J001 with a UC-391 Rev. D USB 2 camera shield and a Windows 10 (64 bit) PC. My intention is to use this camera-shield combination as a camera for my finder-scope. I intend to bin some pixels to increase the fps.
      When I use below Python script, my camera is not found but if I plug in a webcam I get a video stream:

      import numpy as np
      import cv2
      cap = cv2.VideoCapture(0)
      while(True):
      # Capture frame-by-frame
      ret, frame = cap.read()
      # Display the resulting frame
      cv2.imshow(‘color’,frame)
      if cv2.waitKey(1) & 0xFF == ord(‘q’):
      break
      # When everything done, release the capture
      cap.release()
      cv2.destroyAllWindows()

       

      Please advise, thanks in advance 🙂

    • #27272
      wong
      Moderator

      Hi @vk4tnt ,

      The USB 2 camera shield is not a UVC camera, you need to install our driver and use our SDK to use it.

      https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/tree/master/Windows/Python/Streaming_demo

    • #27326
      vk4tnt
      Participant

      Hi Wong,
      I have sucesfuly installed the driver and can run the USBtest although I have no ability to control image brightness.
      I also tested the External trigger software but  it seems the ArducamSDK is missing please see below:

      |
      Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
      Type “help”, “copyright”, “credits” or “license()” for more information.
      >>>
      = RESTART: D:\ArduCAM_USB_Camera_Shield-master\Windows\Python\External_trigger_demo\ArduCam_Ext_Trigger_Demo.py
      Traceback (most recent call last):
      File “D:\ArduCAM_USB_Camera_Shield-master\Windows\Python\External_trigger_demo\ArduCam_Ext_Trigger_Demo.py”, line 9, in <module>
      from ImageConvert import *
      File “D:\ArduCAM_USB_Camera_Shield-master\Windows\Python\External_trigger_demo\ImageConvert.py”, line 2, in <module>
      import ArducamSDK
      ImportError: DLL load failed while importing ArducamSDK: The specified module could not be found.
      >>>

    • #27331
      wong
      Moderator

      Hi @vk4tnt ,

      We did not provide a library for python3.8 in the previous version, we just updated github and added a library for python3.8.

       

    • #27508
      vk4tnt
      Participant

      Hi Wong,
      Thank you for the update. I will try it.
      Best regards and stay safe.

    • #27616
      vk4tnt
      Participant

      Hi Wong,
      Thank you for your help. Installing the 3.8 library helped.
      Do you by any chance have a cfg file for the MT9J001 sensor for 1920×1080 2×2 binning and 12bit readout?
      Regards,
      VK4TNT

    • #27631
      wong
      Moderator

      Hi @vk4tnt ,

      This is not my area of expertise, I have already told the corresponding engineer, and I will notify you when there is progress.

    • #27633
      vk4tnt
      Participant

      Hi Wong,
      Thank you for your support. I think the binning feature I described would also be very useful for the newer MT9J003 colour device as it could be turned into a proper 1920×1080 monochrome camera.
      Best regards and thank you again.
      Renato

    • #27822
      wong
      Moderator
    • #28137
      vk4tnt
      Participant

      Hi Wong,
      Thank you and your engineer for the great effort and sorry for not getting back to you earlier. I finally had time to test the config file and found some discrepancies between it’s behaviour using the GUI Demo and the Streaming Demo. All works ok in the GUI Demo but the Streaming Demo (using ArducamSDK.cp38-win_amd64.pyd) comes up with:

      color mode 0
      Serial: AU2S-1928-0020
      Capture began, rtn_val = 0
      Error capture image, rtn_val = 65317

      Also, there are stripes in the image.

      Please find attached image as reference.
      Thanks again and I look forward seeing your thoughts about the issue.
      Regards,
      Renato

      MT9J001_MONO_8b_1920x1080_subsampling_20fps_Streaming_Demo

    • #28175
      wong
      Moderator

      Hi @vk4tnt ,

      I made a mistake in arducan_config_parser, which caused only hexadecimal numbers starting with 0x to be parsed but not hexadecimal numbers starting with 0X.

      I just submitted an update to change 0X to 0x: https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/commit/29de96e0e731fb0816485bba9722a60ae48e85de

    • #28205
      vk4tnt
      Participant

      Hi Wong,

      Thank you for the quick fix of the INI file. I tested it and it works. There are some Byer Mask issues but I will look into the problem myself and let you know if I find a solution.

      Thinks like case sensitivity can be a trap. Great job fixing it, thank you.
      Regards,
      RenatoMT9J001_MONO_8b_1920x1080_subsampling_20fps

    • #28365
      Arducam jyh
      Moderator

      Hi,

      Thank you for your feedback, we will continue to optimize it in the follow-up work.

       

Viewing 12 reply threads
  • You must be logged in to reply to this topic.