How to adjust the brightness and contrast of an image


I am using the python code from this link jetson-inference/ at master · dusty-nv/jetson-inference · GitHub. I need to adjust the brightness, or contrast of the image captured from the webcam. In opencv, I can easily do this by using

newImg = cv2.convertScaleAbs(image, alpha=1.5, beta=0).

How can I do this in below code:

while display.IsStreaming():
	img = camera.Capture()
	detections = net.Detect(img)
	display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks


You can change the underlying GStreamer pipeline directly.
For the CSI camera, you can find the pipeline below:

For example, you can change it to a similar form as below:

$ gst-launch-1.0 nvarguscamerasrc saturation=1.5 ! nvvidconv !

The range of saturation is 0-2.
Please check with nvgstcapture-1.0 to know how to set the parameter.