TX2 camera manual control

Hello,

Is there a way to deactivate auto exposure on the built in camera?

std::string get_tegra_pipeline(int width, int height, int fps) {
return “nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)” + std::to_string(width) + “, height=(int)” +
std::to_string(height) + “, format=(string)NV12, framerate=(fraction)” + std::to_string(fps) +
"/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR !appsink ";
}
in the main ()

int WIDTH = 1280;
int HEIGHT = 720;
int FPS = 120;

std::string pipeline = get_tegra_pipeline(WIDTH, HEIGHT, FPS);
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);

Thats the code I am using to get the camera to work. I would like to turn off auto exposure and set the gain and shutter speed manually.

Thanks and regards
Arpith

Sorry for the late response, is this still an issue to support?

1 Like

Using exposuretimerange/gainrange should be able do it.
Check the cap by gst-inspect-1.0 nvarguscamerasrc

  exposuretimerange   : Property to adjust exposure time range in nanoseconds
                        Use string with values of Exposure Time Range (low, high)
                        in that order, to set the property.
                        eg: exposuretimerange="34000 358733000"
                        flags: readable, writable
                        String. Default: null
  gainrange           : Property to adjust gain range
                        Use string with values of Gain Time Range (low, high)
                        in that order, to set the property.
                        eg: gainrange="1 16"
                        flags: readable, writable
                        String. Default: null

Thanks @ShaneCCC for responding.

Can I lock the exposure and the white balance?

Do let me know.

regards
Arpith

Also how can I access photo mode. I am running all this on c++ and OpenCV btw

For some reason the same line of code is giving me two different images


Also I essentially want a really dark image. Can u help me with the same please?

Hello @arpithv ,

I hope you are doing well.

If you require to lock the exposure and white balance. Please try with the following nvarguscamerasrc properties:

  aelock              : set or unset the auto exposure lock
                        flags: readable, writable
                        Boolean. Default: false
  awblock             : set or unset the auto white balance lock
                        flags: readable, writable
                        Boolean. Default: false

If you are getting a different image with the same code, could be caused by the ISP processing the same scene at different times. By locking exposure and white balance, you should get a more stable result.

In regards to your other question. Could you please explain to me what is photo mode ? Or what is it that you want to achieve.

best regards,
Andres Campos
Embedded Software Engineer
www.ridgerun.com

Hi @Andreas.campos,

Thanks for the response.

When I use ae lock and awb lock, I am getting the following error.
GStreamer-CRITICAL **: 16:06:54.235: gst_mini_object_set_qdata: assertion ‘object != NULL’ failed

Regarding photo mode, instead of getting a stream of frames, I am trying to just receive 1 frame. In opencv, if use VideoCapture(), it gets a stream of frames. Instead, I want to use imread() and get only 1 frame.

Could you help me with the same please?

Regards
Arpith

Greetings,

Could anyone help me with the syntax for setting auto exposure off

auto-exposure : property to set auto exposure mode
flags: readable, writable
Enum “GstNvCamAutoExposureMode” Default: 2, “on”
(1): off - GST_NVCAM_AUTO_EXPOSURE_OFF
(2): on - GST_NVCAM_AUTO_EXPOSURE_ON
(3): OnAutoFlash - GST_NVCAM_AUTO_EXPOSURE_AUTOFLASH
(4): OnAlwaysFlash - GST_NVCAM_AUTO_EXPOSURE_ALWAYSFLASH
(5): OnFlashRedEye - GST_NVCAM_AUTO_EXPOSURE_AUTO_RED_EYE

and also the intent to still

intent : property to select capture intent
flags: readable, writable
Enum “GstNvCamCaptureIntent” Default: 1, “preview”
(1): preview - GST_NVCAM_INTENT_PREVIEW
(2): still - GST_NVCAM_INTENT_STILL
(3): video - GST_NVCAM_INTENT_VIDEO
(4): video-snapshot - GST_NVCAM_INTENT_VIDEO_SNAPSHOT
(5): zsl - GST_NVCAM_INTENT_ZSL

My current pipeline looks like this

td::string get_tegra_pipeline(int width, int height, int fps) {
return “nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)” + std::to_string(width) + “, height=(int)” +
std::to_string(height) + “, format=(string)NV12, framerate=(fraction)” + std::to_string(fps) +
"/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR !appsink ";
}

Thank you

You would try something like this. You would adapt gains and exposure to your scene and sensor.

Also note that your pipeline string lacks a space before appsink.

@Honey_Patouceul Thanks for that! it helped much.

would you know what the pipeline should look like if I want to use the camera in photo mode?

Can someone continue to help me with this issue please?

my current pipeline looks like this

nvarguscamerasrc sensor-mode= 1 wbmode =daylight awblock = true aelock = true gainrange = “1 1” ispdigitalgainrange=“1 1"exposuretimerange = ‘5000000 5000000’ ! video/x-raw(memory:NVMM), width=(int)” 1280 ", height=(int)“720”, format=(string)NV12, framerate=(fraction)“120”/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink ";

I am getting empty frames when I run this. I need the sensor_mode to be 1.

also I came across this
–capture-gap Number of milliseconds between successive image/video capture. Default = 250 msec (use with --automate and --capture-auto only)

is there a way to set this to <10 msec?

do let me know.

Regards
Arpith

Modify the width/height/framerate to match the sensor mode want to select.

video/x-raw(memory:NVMM), width=(int)” 1280 ", height=(int)“720”, framerate=(fraction)“120”

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.