1st: raw2image does not subtract black level, most likely you need to do that (by calling LibRaw::subtract_black() after raw2image).
Also, you may access raw data via imgdata.rawdata.raw_image (this is flat array with unaltered raw values; pixels outside of active area are included too).
max value of 5600 (before black subtracted) is about ~2 stops lower than this camera data range, so your image is, most likely, heavy underexposed.
1st: raw2image does not subtract black level, most likely you need to do that (by calling LibRaw::subtract_black() after raw2image).
Also, you may access raw data via imgdata.rawdata.raw_image (this is flat array with unaltered raw values; pixels outside of active area are included too).
max value of 5600 (before black subtracted) is about ~2 stops lower than this camera data range, so your image is, most likely, heavy underexposed.