how to archive highest fps at high res on multiple MT9J001 using usb3 shield

hi ArduCam developers,

i have some problem with this usb shield

when I run single camera with single usb hub. i run example from the github can archive frame speed 6-7 fps @10MP the problem when i use multiple camera with multiple usb hub

like this image

multiple camera accessed using multiple application

i can archive 6-7fps @10MP but sometimes got some frame error and many of usb timeout error.

and i already try using single application access multiple camera with the same hardware configuration but still have very slower camera roughly 2 fps when i should switch between the camera ie. should open-close the camera each time switch the camera.

do you have any clue/suggestion about this problem?

thanks,

diriga

Hi,

Don’t worry and I will try my best to help you.

Please attach me you hardare connection and give us the config file you are using. Our engineer will help you test it and reply you.

 

hi bin

my hardware connection configuration:

the hardware connection configuration

and for the config

i use https://github.com/ArduCAM/ArduCAM_USB_Camera_Shield/blob/master/Windows/GUI/USBTest/Release/Config/MT9J001_10MP.cfg

I connected to my notebook

Realimage

Hi,

Thanks for your detail hardware information. We have tested it

After our test, two USB3.0+MT9J001, using the configuration specified by the customer, can run normally at the same time, 6-7fps.

Analyze the customer’s usage scenarios, and the following points need to be confirmed:
① Check whether the About of the two upper computers display Device3 Interface3;
②Confirm whether both HUBs are connected to USB3.0;
③If the notebook has only one 3.0, connect it to a 3.0 HUB and try again.

 

Let me know if you need more help.

 

ub transfer timeout

use usb3

that screen shot from my pc and somehow other camera still got usb transfer error or sometime bad frame image

and from device manager i got this connection configuration

have another clue or idea bin?

Hi,

There is indeed a problem with using the hub. It seems that the hub will affect the USB bandwidth. Please try to remove the hub, connect the camera directly to the computer

and restart it.

hi bin

after i try to connect direct to usb this solve the usb timeout problem

but there are still some issue when i press stop and play again show bad frame received like in this image

bad frame when stop and start again

and another problem when we use c++ streaming example and modified this with sequence

  1. open camera 1

  2. request capture camera 1

  3. wait image ready when not ready jump to 2

  4. read the image on camera 1

  5. close camera 1

and then repeat for other camera i only can archive 2-3 fps.

when i do

  • open all camera
for each camera do :
  1. request capture camera 1
  2. wait image ready when not ready jump to 1
  3. read the image on camera 1
from this scenario i got some bad frame received and some usb timeout and speed cannot reach 7 fps. still got 3 fps

are u have any idea bin?

 

 

 

hi bin

sory forgot fyi after i read image i delete the buffer

Hello @sokeryujin ,

Can you provide the relevant C++ code? I am not sure what you did in the “request capture”.

Hi sokoryujin,

Regarding the bad frame you mentioned, does it keep appearing after clicking stop and open or does it return to normal after a few bad frames? I test it on my computer, When I click the stop and open it also appear bad frames but after a few bad frames it will return to normal.Even if I use one camera , the same result. When I click close and open it will not appear bad frame. You can try it.

About the bad frame when click stop and open, it is due to When we click click , we do not have clear the data buffer.

About the c++ streaming example, our engineer will help you check it. Please attach us your whole code.

 

hi bin and wong

you correct bin in my pc happen like your explain “When I click the stop and open it also appear bad frames but after a few bad frames it will return to normal”

then because of that the frame rate is going slow after start(begin capture)+capture

for wong

“request capture” is at first call is begin capture dan ArduCam_captureImage

the second call is only ArduCam_captureImage

like below

Uint32 rtn_val = ArduCam_beginCaptureImage(handle);
if (rtn_val == USB_CAMERA_USB_TASK_ERROR) {
std::cout << "Error beginning capture, rtn_val = " << rtn_val << std::endl;
return;
}
else {
std::cout << "Capture began, rtn_val = " << rtn_val << std::endl;
}

while ((ArduCam_availableImage(handle) > 0)!=true)
{
rtn_val = ArduCam_captureImage(handle);
if (rtn_val == USB_CAMERA_USB_TASK_ERROR) {
std::cout << "Error capture image, rtn_val = " << rtn_val << std::endl;
break;
}
else if (rtn_val > 0xFF) {
std::cout <<"device id= “<<idxcam <<” Error capture image, rtn_val = " << rtn_val << std::endl;
}
}

and this working link runnable code but the frame rate cannot reach 7fps only 3 or 4fps

 

 

 

Hi @sokoryujin ,

Since no threads are opened inside the SDK, we need ArduCam_captureImage to read data from usb in a loop. If you do a time-consuming operation between two ArduCam_captureImage calls, some data will be lost and the frame rate will drop. Therefore we recommend using a separate thread to call ArduCam_captureImage.

hi wong

after several trial using you recomendation

not easy to using separate thread for ArduCam_captureImage

from last i trial to separate this the rough fps only reach 2 fps, are u have more example when multiple camera wong?

are u sure ArduCam_captureImage is to read data from usb ? not from camera sensor to usb shield?

read data from usb shield are not ArduCam_readImage?

thanks

 

 

Hi @sokoryujin ,

The streaming_demo example uses two threads. What is the frame rate used directly without modifying it?

 

Hi @wong

From current example without modified only handle 1 camera so the frame rate is 6-7fps

When i run multiple example to access camera sometime frame len not enough and sometime usb timeout

The problem when example to use camera more than 1 the code should modified when code running in single app or process. In mya modified version like on your manual follow this step for each camera

open camera

Process where the proses is begin capture, capture,read image, endcapture

Close camera

This make the frame drop to 2-3fps

Are u have example when multiple camera running accessed using single process

And arducam camera sdk for python have the same handling? Should be multiple process (not thread)?

 

Hi @sokoryujin ,

I wrote a simple example, it can make both cameras reach 6-7fps, the code is here:

https://github.com/glddiv/Arducam_Opencv_Demo/releases/download/v0.1/Arducam_Opencv_Demo.zip

hi @wong

thanks for the example. i already try your example here the result

multiplecam running mostly when i run several time i got the right get frame 6 or 7 fps and sometime when error i only got 3fps or 4 fps

and for image capture always get delay 175 millisecond

delayed image

thanks

Hi @sokoryujin ,

The 175 millisecond delay should be caused by the display.

sometime when error i only got 3fps or 4 fps
Are there any errors at this time?