Trigger a webcam with push button Nvidia Jetson Nano

Hi I want to trigger my webcam with push button for my Jetson Nano.I have seen some Raspberry pi references with that but I don’t know how to do with Nvidia Jetson Nano.Here is what I have done with opencv but it is not quite correct.

So I want to get some suggestion with the code. The logic is that once I run my.py file, the webcam will turn on and if I press the button, it should capture the image, And if I release the button, it will not do anything.

Hi kmyat3116,

Please continue updating on your original topic - Image capturing with GPIO pin - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums