Easy Python programming sample for USB2 camera shield
Published by vk4tnt on
- August 29, 2020 at 1:56 am #27268
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
cap = cv2.VideoCapture(0)
# Capture frame-by-frame
ret, frame = cap.read()
# Display the resulting frame
if cv2.waitKey(1) & 0xFF == ord(‘q’):
# When everything done, release the capture
Please advise, thanks in advance 🙂
- August 30, 2020 at 5:37 pm #27272
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.
- August 31, 2020 at 6:26 am #27326
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>
ImportError: DLL load failed while importing ArducamSDK: The specified module could not be found.
- August 31, 2020 at 7:42 pm #27331
- September 2, 2020 at 9:43 pm #27508
Thank you for the update. I will try it.
Best regards and stay safe.
- September 5, 2020 at 12:46 am #27616
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?
- September 6, 2020 at 10:35 pm #27631
- September 7, 2020 at 12:45 am #27633
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.
- September 10, 2020 at 10:50 pm #27822
Hi @vk4tnt ,
Our engineer configured a 1920×1080 configuration based on subsampling.
- September 19, 2020 at 3:43 am #28137
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
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.
- September 21, 2020 at 7:02 pm #28175
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
- September 22, 2020 at 5:28 am #28205
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.
- September 26, 2020 at 10:31 pm #28365Arducam jyhModerator
Thank you for your feedback, we will continue to optimize it in the follow-up work.
- You must be logged in to reply to this topic.