def change(self): if self.normal_radio.isChecked(): result = self.reference self.gray_check.setEnabled(False) self.equalize_check.setEnabled(False) self.last_radio = self.normal_radio elif self.difference_radio.isChecked(): result = self.difference self.gray_check.setEnabled(True) self.equalize_check.setEnabled(True) self.last_radio = self.difference_radio elif self.ssim_radio.isChecked(): result = self.ssim_map self.gray_check.setEnabled(False) self.equalize_check.setEnabled(True) self.last_radio = self.ssim_radio elif self.butter_radio.isChecked(): result = self.butter_map self.gray_check.setEnabled(True) self.equalize_check.setEnabled(False) self.last_radio = self.butter_radio else: self.last_radio.setChecked(True) return if self.equalize_check.isChecked(): result = equalize_img(result) if self.gray_check.isChecked(): result = desaturate(result) self.reference_viewer.update_original(result)
def process(self): start = time() scale = self.scale_spin.value() contrast = int(self.contrast_spin.value() / 100 * 128) linear = self.linear_check.isChecked() grayscale = self.gray_check.isChecked() if not linear: difference = cv.absdiff(self.original, self.compressed.astype(np.float32) / 255) ela = cv.convertScaleAbs(cv.sqrt(difference) * 255, None, scale / 20) else: ela = cv.convertScaleAbs(cv.subtract(self.compressed, self.image), None, scale) ela = cv.LUT(ela, create_lut(contrast, contrast)) if grayscale: ela = desaturate(ela) self.viewer.update_processed(ela) self.info_message.emit(self.tr('Error Level Analysis = {}'.format(elapsed_time(start))))
def process(self): start = time() quality = self.quality_spin.value() scale = self.scale_spin.value() / 20 contrast = int(self.contrast_spin.value() / 100 * 128) equalize = self.equalize_check.isChecked() grayscale = self.gray_check.isChecked() self.scale_spin.setEnabled(not equalize) self.contrast_spin.setEnabled(not equalize) compressed = compress_jpeg(self.image, quality).astype(np.float32) / 255 difference = cv.absdiff(self.original, compressed) if equalize: ela = equalize_img((difference * 255).astype(np.uint8)) else: ela = cv.convertScaleAbs(cv.sqrt(difference) * 255, None, scale) ela = cv.LUT(ela, create_lut(contrast, contrast)) if grayscale: ela = desaturate(ela) self.viewer.update_processed(ela) self.info_message.emit(self.tr('Error Level Analysis = {}'.format(elapsed_time(start))))
def change(self): self.gray_check.setEnabled(False) self.equal_check.setEnabled(False) if self.normal_radio.isChecked(): self.reference_viewer.update_original(self.reference) self.last_radio = self.normal_radio elif self.diff_radio.isChecked(): self.gray_check.setEnabled(True) self.equal_check.setEnabled(True) if self.equal_check.isChecked(): result = self.equalized else: result = self.difference if self.gray_check.isChecked(): result = desaturate(result) self.reference_viewer.update_original(result) self.last_radio = self.diff_radio elif self.map_radio.isChecked(): self.reference_viewer.update_original(self.indexmap) self.last_radio = self.map_radio else: self.last_radio.setChecked(True)