Arducam UC-625 with UC506

Hi, I have managed to get to the point where 1_test.py runs however after I select the mode [7], I have an error. I have connected the board onto Raspberry PI 4 4G and have set 180Mb of memory for the GPU. I have tested on raspistill and it worked fine. I have upgrade the firmware etc. on the Pi. Please can you help?

“~/MIPI_Camera/RPI/stereo_depth_demo $ python 1_test.py
Open camera…
Found sensor imx219 at address 10
mode: 7, width: 1600, height: 600
mode: 8, width: 2560, height: 720
mode: 9, width: 3840, height: 1080
mode: 10, width: 5184, height: 1944
mode: 11, width: 6528, height: 1848
mode: 12, width: 6528, height: 2464
Please enter the mode number:7
mmal: Failed to fix lens shading, use the default mode!
Current mode: 7,resolution: 1600x600
^CTraceback (most recent call last):
File “1_test.py”, line 85, in <module>
cv2.imshow(“Arducam”, frame)
KeyboardInterrupt”

Please ensure you have installed all the additional repositories

Hi Bin, could you please post the link because, I found one on a blog which I followed and didn’t have much success with and and I then followed steps in a readme file with which i got further but not far enough to be able to run the 1_tests.py etc.

Is there a way to find what the missing files/repositories are?

Thank you in advance.

Hi Bin, please see below output of installing libraries i thought may have been missing.

 

[email protected]:~/MIPI_Camera/RPI $ sudo apt-get update && sudo apt-get install libzbar-dev libopencv-dev Hit:1 http://archive.raspberrypi.org/debian buster InRelease Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done libopencv-dev is already the newest version (3.2.0+dfsg-6). libzbar-dev is already the newest version (0.22-1). The following package was automatically installed and is no longer required: libmicrodns0 Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. [email protected]:~/MIPI_Camera/RPI $ make clean && make rm -f *.o rm -f video4cameras preview_setMode arducamstill capture video list_format capture_raw raw_callback yuv_callback read_write_sensor_reg ov9281_external_trigger 2MPGlobalShuterDemo preview-camera0 preview-dualcam capture-dualcam video2stdout capture2opencv qrcode_detection opencvGui gcc -I. -g -O0 -std=gnu11 -o video4cameras video4cameras.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview_setMode preview_setMode.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o arducamstill arducamstill.c -larducam_mipicamera -lpthread arducamstill.c: In function ‘main’: arducamstill.c:408:50: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types] int ret = pthread_create(&processCmd_pt, NULL, prcessCmd,&processData); ^~~~~~~~~ In file included from arducamstill.c:9: /usr/include/pthread.h:236:15: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(PROCESS_STRUCT *)’ {aka ‘void (*)(struct <anonymous> *)’} void *(*__start_routine) (void *), ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ gcc -I. -g -O0 -std=gnu11 -o capture capture.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o video video.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o list_format list_format.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o capture_raw capture_raw.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o raw_callback raw_callback.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o yuv_callback yuv_callback.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o read_write_sensor_reg read_write_sensor_reg.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o ov9281_external_trigger ov9281_external_trigger.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o 2MPGlobalShuterDemo 2MPGlobalShuterDemo.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview-camera0 preview-camera0.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview-dualcam preview-dualcam.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o capture-dualcam capture-dualcam.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o video2stdout video2stdout.c -larducam_mipicamera -lpthread g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o capture2opencv capture2opencv.cpp -larducam_mipicamera -lpthread g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o qrcode_detection qrcode_detection.cpp -larducam_mipicamera -lpthread -lzbar g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o opencvGui opencvGui.cpp -larducam_mipicamera -lpthread [email protected]:~/MIPI_Camera/RPI $ ./video Open camera... Found sensor imx219 at address 10 Setting the resolution... Can't open the file mmal: Failed to fix lens shading, use the default mode! Current resolution is 1920x1080 Notice:You can use the list_format sample program to see the resolution and control supported by the camera. Start preview... Enable Software Auto Exposure... Enable Software Auto White Balance... Start video encoding... Total frame count = 1 TimeElapsed = 10.000084 Stop video encoding... Close camera... [email protected]:~/MIPI_Camera/RPI $

Hi Bin, please see below output of installing libraries i thought may have been missing.

 

[email protected]:~/MIPI_Camera/RPI $ sudo apt-get update && sudo apt-get install libzbar-dev libopencv-dev Hit:1 http://archive.raspberrypi.org/debian buster InRelease Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done libopencv-dev is already the newest version (3.2.0+dfsg-6). libzbar-dev is already the newest version (0.22-1). The following package was automatically installed and is no longer required: libmicrodns0 Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. [email protected]:~/MIPI_Camera/RPI $ make clean && make rm -f *.o rm -f video4cameras preview_setMode arducamstill capture video list_format capture_raw raw_callback yuv_callback read_write_sensor_reg ov9281_external_trigger 2MPGlobalShuterDemo preview-camera0 preview-dualcam capture-dualcam video2stdout capture2opencv qrcode_detection opencvGui gcc -I. -g -O0 -std=gnu11 -o video4cameras video4cameras.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview_setMode preview_setMode.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o arducamstill arducamstill.c -larducam_mipicamera -lpthread arducamstill.c: In function ‘main’: arducamstill.c:408:50: warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type [-Wincompatible-pointer-types] int ret = pthread_create(&processCmd_pt, NULL, prcessCmd,&processData); ^~~~~~~~~ In file included from arducamstill.c:9: /usr/include/pthread.h:236:15: note: expected ‘void * (*)(void *)’ but argument is of type ‘void (*)(PROCESS_STRUCT *)’ {aka ‘void (*)(struct <anonymous> *)’} void *(*__start_routine) (void *), ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ gcc -I. -g -O0 -std=gnu11 -o capture capture.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o video video.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o list_format list_format.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o capture_raw capture_raw.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o raw_callback raw_callback.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o yuv_callback yuv_callback.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o read_write_sensor_reg read_write_sensor_reg.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o ov9281_external_trigger ov9281_external_trigger.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o 2MPGlobalShuterDemo 2MPGlobalShuterDemo.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview-camera0 preview-camera0.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o preview-dualcam preview-dualcam.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o capture-dualcam capture-dualcam.c -larducam_mipicamera -lpthread gcc -I. -g -O0 -std=gnu11 -o video2stdout video2stdout.c -larducam_mipicamera -lpthread g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o capture2opencv capture2opencv.cpp -larducam_mipicamera -lpthread g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o qrcode_detection qrcode_detection.cpp -larducam_mipicamera -lpthread -lzbar g++ -I. -g -std=gnu++11 pkg-config --cflags --libs opencv -o opencvGui opencvGui.cpp -larducam_mipicamera -lpthread

Hi,

I have searched this error. This seems to be a coding problem instead of compiling error.I think your code is right.

Can you try to delete the old file and create a new file to retry?

 

Hi Bin, and thank you for your help.

 

I am only trying to run the example code from the arducam github repository in http://github.com/ArduCAM/MIPI_Camera/tree/master/RPI/stereo_depth_demo or even just the ./video file and it crashed.

This is not my own code. Do you mean I should delete and reinstall the MIPI repository from GitHub? I can do that no problem however please confirm this is what you would like me to try.

 

Thank you.

 

Hi,

Yes, you can try to delete and reinstall the MIPI_Camera library. If the problem is still exist, I will tell our engineer to check it.

 

Hi Bin,

Ok I deleted the folder and followed the steps to download the repository and compile the files and install and i was able to run ./video this time but i am still not able to run the demos in /stereo_depth_demo and I still get the error “mmal: Failed to fix lens shading, use default mode!”

The farthest I got was to be able to run “python 1_test.py” which displayed a dual screen image upside down and in green colour I have been able to test “1_test.py” in mode 7 through to 10 all were upside down and green in colour.

I cant run any of the other demos in the folder.

 

 

Ok I was able to run ./video before from the main RPI folder but i can not do that anymore it just closes after 1 frame.

It recognises my dual camera on the board UC506 as IMX219 (i am supposed to have dual 8Mpix cameras) but in the folder lens_shading_table I can not see a folder name IMX219. Only the following.

  1. ov5647

  2. imx298

  3. imx135

  4. ar1820

Hi,

We optimized the frame rate and Angle of 219. the lens shading table we create before is not suitable for it now. When I am free, I will recreate new lens shading table again.

 

Hi Bin,

Does that mean I can now test the camera until the lens shading table is created?

Hi Bin, good morning, when would the the lens shading table for IMX219 be available? My understanding is that without it cant test all the demo casses.

 

 

Hi,

I am too busy to create the lens shading table recently. Tomorrow I will spare some time to help you fix it.

It does not affect your to test various modes.

Hi Bin, Thank you very much for making that table.

So do you think i should be able to run the stereo depth demos without updated lens shading table?

I have tested 1_test.py again just now and again the image is upside down and green, I can only run mode 7 to 10 anything higher I get “Null Pointer Access”. In addition i am not able to run 2_chess_cycle.py and get the error below still.

[email protected]:~/MIPI_Camera/RPI/stereo_depth_demo $ python 2_chess_cycle.py Open camera... Found sensor imx219 at address 10 Can't open the file mmal: Failed to fix lens shading, use the default mode! Current mode: 2,resolution: 1600x1200 Used camera resolution: 1600 x 1200 Scaled image resolution: 1280 x 480 Starting photo sequence Traceback (most recent call last): File "2_chess_cycle.py", line 88, in <module> frame = get_frame(camera) File "2_chess_cycle.py", line 44, in get_frame image = frame.as_array.reshape(int(height * 1.5), width) File "/home/pi/MIPI_Camera/RPI/stereo_depth_demo/arducam_mipicamera.py", line 266, in as_array return np.ctypeslib.as_array(self.buffer_ptr[0].data, shape=(self.length,)) ValueError: NULL pointer access

and then

[email protected]:~/MIPI_Camera/RPI/stereo_depth_demo $ python 3_pairs_cut.py
No file named ./scenes/scene_1280x480_1.png
No file named ./scenes/scene_1280x480_2.png
No file named ./scenes/scene_1280x480_3.png
No file named ./scenes/scene_1280x480_4.png
No file named ./scenes/scene_1280x480_5.png
No file named ./scenes/scene_1280x480_6.png
No file named ./scenes/scene_1280x480_7.png
No file named ./scenes/scene_1280x480_8.png
No file named ./scenes/scene_1280x480_9.png
No file named ./scenes/scene_1280x480_10.png
No file named ./scenes/scene_1280x480_11.png
No file named ./scenes/scene_1280x480_12.png
No file named ./scenes/scene_1280x480_13.png
No file named ./scenes/scene_1280x480_14.png
No file named ./scenes/scene_1280x480_15.png
No file named ./scenes/scene_1280x480_16.png
No file named ./scenes/scene_1280x480_17.png
No file named ./scenes/scene_1280x480_18.png
No file named ./scenes/scene_1280x480_19.png
No file named ./scenes/scene_1280x480_20.png
No file named ./scenes/scene_1280x480_21.png
No file named ./scenes/scene_1280x480_22.png
No file named ./scenes/scene_1280x480_23.png
No file named ./scenes/scene_1280x480_24.png
No file named ./scenes/scene_1280x480_25.png
No file named ./scenes/scene_1280x480_26.png
No file named ./scenes/scene_1280x480_27.png
No file named ./scenes/scene_1280x480_28.png
No file named ./scenes/scene_1280x480_29.png
No file named ./scenes/scene_1280x480_30.png
End cycle


 

Hello, I am having the same issues as sahill with 2_chess_cycle.py. I get the following:

python 2_chess_cycle.py
Open camera…
Found sensor imx219 at address 10
Can’t open the file
mmal: Failed to fix lens shading, use the default mode!
Current mode: 2,resolution: 1600x1200
Used camera resolution: 1600 x 1200
Scaled image resolution: 1280 x 480
Starting photo sequence
Traceback (most recent call last):
File “2_chess_cycle.py”, line 88, in <module>
frame = get_frame(camera)
File “2_chess_cycle.py”, line 44, in get_frame
image = frame.as_array.reshape(int(height * 1.5), width)
File “/home/pi/MIPI_Camera/RPI/stereo_depth_demo/arducam_mipicamera.py”, line 266, in as_array
return np.ctypeslib.as_array(self.buffer_ptr[1].data, shape=(self.length,))
ValueError: NULL pointer access

 

Hi,

Yes, the lens shading just improving the dark Angle of the lens. You can try it without lens shading.

ValueError: NULL pointer access means it does not receive image from the sensor. There is nothing to do with the lens shading. Do you use our new libarducam_mipicamera.so ?

Recently, I have updated our libarducam_mipicamera.so. You can try to download our new lib to try. Notice to run make install to install the new lib.

What’s more, you can use arducamstill demo to test each mode firstly to ensure each mode can work normally.

https://github.com/ArduCAM/MIPI_Camera/blob/master/RPI/arducamstill.c

just run ./arducamstill -t 0 -m [mode]

Let me know if you need more help.

 

Thanks, Bin. I got most of the above to work. I am still dealing with a green screen when i run all the demo python scripts which seems to be affecting the calibration? I can tune the color and brightness of the screen using ./arducamstill -t 0 but then when i run python 1_test.py it shows up as green. I found your post here which seems like a potential solution:

https://www.arducam.com/forums/search/green/

However which exact file (name and file extension) do I need to update in order to do that. If it’s a .c file, how would you compile the c code using the command line?

when i run the 4_calibration.py file, it ignores all of my 30 images.

I look forward to hearing from you.

Best,

Tom

Thanks, Bin. I am still getting a green screen when I run python 1_test.py. I played with ./arducamstill -t 0 and was able to tune the color brightness and focus. However, when I run 1_test.py, it goes back to green.

I saw in another post that you changed the register values or the set mode? Which exact file would you make those changes to and if the file is a c file, do you need to compile after? How would you compile that file on the command line?

Also, when i run 4_calibration.py, it ignores all 30 of my images. I am assuming because too dark and green?

Best,

Tom

Hi Bin,

I have just downloaded and compiled the github repository as per your instructions and I still get the results below. Is the hardware faulty?

 

[email protected]:~/MIPI_Camera/RPI $ ./arducamstill -t 0 -m 1 -awb 1 -ae 1 <---This failed to load an image and just hung! Open camera... Found sensor imx219 at address 10 mode: 0, width: 800, height: 600, pixelformat: pRAA, desc: (null) mode: 1, width: 1280, height: 720, pixelformat: pRAA, desc: (null) mode: 2, width: 1600, height: 1200, pixelformat: pRAA, desc: (null) mode: 3, width: 1920, height: 1080, pixelformat: pBAA, desc: (null) mode: 4, width: 2592, height: 1944, pixelformat: pRAA, desc: (null) mode: 5, width: 3264, height: 1848, pixelformat: pRAA, desc: (null) mode: 6, width: 3264, height: 2464, pixelformat: pRAA, desc: (null) mode: 7, width: 1600, height: 600, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT mode: 8, width: 2560, height: 720, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT mode: 9, width: 3840, height: 1080, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT mode: 10, width: 5184, height: 1944, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT mode: 11, width: 6528, height: 1848, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT mode: 12, width: 6528, height: 2464, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT index: 0, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 1000 Can't open the file mmal: Failed to fix lens shading, use the default mode! Failed to set focus, the camera may not support this control. Failed to set focus, the camera may not support this control. Start preview... Current mode: 1, width: 1280, height: 720, pixelformat: pRAA, desc: (null)

[email protected]:~/MIPI_Camera/RPI $ ./arducamstill
Open camera…
Found sensor imx219 at address 10
mode: 0, width: 800, height: 600, pixelformat: pRAA, desc: (null)
mode: 1, width: 1280, height: 720, pixelformat: pRAA, desc: (null)
mode: 2, width: 1600, height: 1200, pixelformat: pRAA, desc: (null)
mode: 3, width: 1920, height: 1080, pixelformat: pBAA, desc: (null)
mode: 4, width: 2592, height: 1944, pixelformat: pRAA, desc: (null)
mode: 5, width: 3264, height: 1848, pixelformat: pRAA, desc: (null)
mode: 6, width: 3264, height: 2464, pixelformat: pRAA, desc: (null)
mode: 7, width: 1600, height: 600, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
mode: 8, width: 2560, height: 720, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
mode: 9, width: 3840, height: 1080, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
mode: 10, width: 5184, height: 1944, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
mode: 11, width: 6528, height: 1848, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
mode: 12, width: 6528, height: 2464, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT
index: 0, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 876
Can’t open the file
mmal: Failed to fix lens shading, use the default mode!
Failed to set focus, the camera may not support this control.
Failed to set focus, the camera may not support this control.
Start preview…
Current mode: 0, width: 800, height: 600, pixelformat: pRAA, desc: (null)
[Framerate]: 21 pfs, [Exposure]: 2493, [Focus]: 0000,[Rgain]: 0100, [Bgain]: 0100


[email protected]:~/MIPI_Camera/RPI/stereo_depth_demo $ python 1_test.py
Open camera…
Found sensor imx219 at address 10
mode: 7, width: 1600, height: 600
mode: 8, width: 2560, height: 720
mode: 9, width: 3840, height: 1080
mode: 10, width: 5184, height: 1944
mode: 11, width: 6528, height: 1848
mode: 12, width: 6528, height: 2464
Please enter the mode number:12
mmal: Failed to fix lens shading, use the default mode!
Current mode: 12,resolution: 6528x2464
^CTraceback (most recent call last):
File “1_test.py”, line 83, in <module>
frame = get_frame(camera)
File “1_test.py”, line 48, in get_frame
image = cv2.cvtColor(image, cv2.COLOR_YUV2BGR_I420)
KeyboardInterrupt
[email protected]:~/MIPI_Camera/RPI/stereo_depth_demo $ python 2_chess_cycle.py
Open camera…
Found sensor imx219 at address 10
Can’t open the file
mmal: Failed to fix lens shading, use the default mode!
Current mode: 2,resolution: 1600x1200
Used camera resolution: 1600 x 1200
Scaled image resolution: 1280 x 480
Starting photo sequence
Traceback (most recent call last):
File “2_chess_cycle.py”, line 88, in <module>
frame = get_frame(camera)
File “2_chess_cycle.py”, line 44, in get_frame
image = frame.as_array.reshape(int(height * 1.5), width)
File “/home/pi/MIPI_Camera/RPI/stereo_depth_demo/arducam_mipicamera.py”, line 266, in as_array
return np.ctypeslib.as_array(self.buffer_ptr[0].data, shape=(self.length,))
ValueError: NULL pointer access