GuoShi28/CBDNet

Question about JPEG compression in generating synthetic noisy image

sky135410 opened this issue · 2 comments

Thanks for provide the python code of isp process.
I do not know which part in the ISP_implement.py correspond to the JPEG compression. .Can you tell me the answer?
Very thanks

I did not add this part in this released code. You can refer to the following code.

        # img_Irgb_convert: input noisy image
        # function: add JPEG compression in noisy image
        max_jpeg = 100
        min_jpeg = 90
        quality_num = random.uniform(min_jpeg, max_jpeg)
        # print(quality_num) 
        encode_param=[int(cv2.IMWRITE_JPEG_QUALITY),quality_num]
        img_Irgb_convert_bgr = self.RGB2BGR(img_Irgb_convert)
        result,encimg = cv2.imencode('.jpg',img_Irgb_convert_bgr*255,encode_param)
        #decode from jpeg format
        decimg_bgr = cv2.imdecode(encimg,1)
        decimg_bgr = decimg_bgr.astype('double') /255
        img_Irgb_convert = self.BGR2RGB(decimg_bgr)

Thank you for the solution.
I will try this.