Some questions about auto focus camera on Jetson Nano

The first question:

I received my first IMX219-auto focus camera for Jetson Nano a few days ago. But i don’t know how to operate the auto focus function. I tried this command: $ DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1’ ! nvoverlaysink -e But it cannot perform the focus by using the up-down arrow keys. I also tried the sample code downloaded from your website, but also cannot do manual focus. How can i do

The second question:

I want to: 1. press a button on GUI to perform auto focus; 2. use arrow keys (or other keys) to perform manual focus, as it do in your demo

 

This is the image from the camera

Hi @Margarito Lehmann ,

  1. We are a recently updated repository and added a manual focus example, you can check it.

  2. At present, we do not provide GUI examples, more advanced usage requires you to implement it yourself.

Hi Wong:

Thank you for adding the manual focus test code to your repository. I tried your examples, but there some error, as shown below:

File “/home/amtd/JN_Camera_Test/JetsonCamera.py”, line 10, in <module>
from Queue import Queue
ModuleNotFoundError: No module named ‘Queue’.

So can not run.

Where can I find or install the Queue module?

Thanks.

Hi @cydu ,

Sorry, I only tested on python2.7, omit the test of python3, now this problem has been fixed. Thanks for your feedback.

Hi @ Wong:
I tested the manual focus function. Now it works. Thank you very much for your codes.

In the meantime, I also tested the auto-focus code. It is found that the camera stops at focus_distance = ~500 (at this position, the image is very blurred), but actually the focus_distance is 380 (at this position, the image is most clear). Can you please retest your code?

I saw a very clear image (it should be the position of focus_distance=380) during the auto focus processing, but the camera stopped at wrong position, capturing blurred image.

Hi @cydu ,

Autofocus script is a very simple implementation of autofocus. It will fail in some scenes. Try to find some scenes with more textures to run the script.

Hi, Wong:

Thanks to your Focuser.py, I can do manual focus for camera 1 of JN-B01. Now I need to do the same for camera 2 of JN-B01. I found the address setting of camera 1 is: CHIP_I2C_ADDR = 0x0C. What’s it for camera 2? Or what i need do in order to conduct manual focus for camera 2?

Thank you in advance.

Hi @cydu ,

The i2c address is the same, but the difference is the i2c bus. On JN-B01, the i2c bus of CAM0 is 7, and the i2c bus of CAM1 is 8.

Hi @cydu and @wong,

I’ve just got my first arducam 8MP IMX219 Low distortion M12 lens, and I’m trying to make it work on a jetson nano B01, but the images and videos I get are really blurry… I’ve reasearched a little until I found this forum wich seems to solve the problem with your autofocus scripts, I’ve tried to run these scripts, but it seems to bump into a problem in the line:

os.system(“i2cset -y {} 0x{:02X} {} {}”.format(self.bus, chip_addr, data1, data2))

since I get “Error: Write failed”,

I’ve tried to manually set the focal distance to 10, which is the beginnning of the autofocus script and would run: i2cset -y 8 0x0C 0 160, I’ve also tried to run this on the command line on the jetson but it generates the same error: “Error: Write failed”.

Also tried with the value discussed in this forum… focal distance: 380 which generates this command: i2cset -y 8 0x0C 23 192 and still get the same error.

Could you please illustrate me of what could be the cause of this error, or maybe what I’m doing wrong, I’m excited to work with the arducam but I haven’t been able to solve the blurry images problem.

Thanks in advance for any help.

Hi @DanielS ,

We are very sorry, but there have been some problems in our system recently, which caused us not to see your reply.
Not sure if your problem has been resolved, here is the response to the problem:

“8MP IMX219 Low distortion M12 lens” does not have a focus motor, it requires manual focus.

Best Regards,