Picam2 capture_array return constant pixel value

1. Where did you get the camera module(s)?

2. Model number of the product(s).
Arducam IMX219 Auto Focus IR Sensitive (NoIR) Camera Module, drop-in replacement for Raspberry Pi V2 and Jetson Nano Camera
Arducam Raspberry Pi Noir Camera Module, 8MP IMX219 RPi-CAM-V2

3. What hardware/platform were you working on?
Raspberry pi 4, 2GB

4. Instructions you have followed. (link/manual/etc.)
Installed all required drivers and Picamera2. All preview and recordings are working.

5. Problems you were having.
when using the below code, the first two frames captured are real, the pixels of the other 4 has constant value of 127 or 128.

  1. What help do you need?
    how to capture relevant images


from picamera2 import Picamera2
import time
from pprint import *
from picamera2.encoders import Encoder
import sys
import matplotlib.pyplot as plt
import json
import libcamera
import numpy as np
import scipy.io

def capture(ET,AG):
with open(“conf.json”, “r”) as read_content:
conf = json.load(read_content)

conf["controls"]["NoiseReductionMode"] = libcamera.controls.draft.NoiseReductionModeEnum.Off

conf['controls']['ExposureTime'] = ET
conf['controls']['AnalogueGain'] = AG

picam2 = Picamera2()

still_config = picam2.create_still_configuration(**conf)

size = still_config['main']['size']
buffer_count = conf['buffer_count']

prog_buffer = np.zeros((buffer_count, size[1],size[0],3))



for ii in range(buffer_count):
    prog_buffer[ii,:,:,:] = picam2.capture_array()

return picam2, prog_buffer

scipy.io.savemat(‘./record/arrdata_ET-{0}_AG-{1}.mat’.format(ET,AG), mdict={‘data’: prog_buffer})

for ET in [4000]:
for AG in [10]:
picam2, buffer = capture(ET,AG)

The problem was with setting contrast to 0.
Problem solved by changing it to “normal” - 1.