image-editor #1
|
|
@ -1,5 +1,7 @@
|
||||||
import abc
|
import abc
|
||||||
from ImageProcessingWorker import ImageProcessingWorker
|
import ImageProcessingWorker
|
||||||
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from PyQt6.QtWidgets import QApplication, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QWidget, QFileDialog, QSlider, QLineEdit, QDialog
|
from PyQt6.QtWidgets import QApplication, QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QWidget, QFileDialog, QSlider, QLineEdit, QDialog
|
||||||
|
|
@ -9,10 +11,10 @@ from PyQt6.QtCore import Qt, QPoint, QThread
|
||||||
from ImageParameterDialog import ImageParameterDialog
|
from ImageParameterDialog import ImageParameterDialog
|
||||||
|
|
||||||
|
|
||||||
class HueDialog(ImageParameterDialog):
|
class HCLDialog(ImageParameterDialog):
|
||||||
def __init__(self, hsv_image):
|
def __init__(self, hsv_image):
|
||||||
super().__init__(hsv_image)
|
super().__init__(hsv_image, ImageProcessingWorker.HLSImageProcessingWorker)
|
||||||
self.setWindowTitle("Hue Correction Dialog")
|
self.setWindowTitle("HCL Correction")
|
||||||
self.layout = QVBoxLayout()
|
self.layout = QVBoxLayout()
|
||||||
|
|
||||||
self.hue_slider = QSlider(Qt.Orientation.Horizontal)
|
self.hue_slider = QSlider(Qt.Orientation.Horizontal)
|
||||||
|
|
@ -39,6 +41,7 @@ class HueDialog(ImageParameterDialog):
|
||||||
self.layout.addWidget(self.chroma_slider)
|
self.layout.addWidget(self.chroma_slider)
|
||||||
self.layout.addWidget(self.label3)
|
self.layout.addWidget(self.label3)
|
||||||
self.layout.addWidget(self.lightness_slider)
|
self.layout.addWidget(self.lightness_slider)
|
||||||
|
self.layout.addWidget(self.button_box)
|
||||||
|
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
|
|
||||||
|
|
@ -54,15 +57,16 @@ class HueDialog(ImageParameterDialog):
|
||||||
|
|
||||||
def process_image(self,hsv_image, values):
|
def process_image(self,hsv_image, values):
|
||||||
hue = values.get('hue', 0.0) / 2
|
hue = values.get('hue', 0.0) / 2
|
||||||
chroma = values.get('chroma', 0.0) + 1.0
|
chroma = values.get('chroma', 0.0)
|
||||||
lightness = values.get('lightness', 0.0) + 1.0
|
lightness = values.get('lightness', 0.0)
|
||||||
|
|
||||||
hsv_image[..., 0] = (hsv_image[..., 0] + hue) % 180
|
hsv_image[..., 0] = (hsv_image[..., 0] + hue) % 180
|
||||||
|
|
||||||
# Adjust chroma (saturation)
|
hsv_image[..., 1] += (255 * lightness)
|
||||||
hsv_image[..., 1] = np.clip(hsv_image[..., 1] * chroma, 0, 255)
|
hsv_image[..., 1] = np.clip(hsv_image[..., 1], 0, 255)
|
||||||
|
|
||||||
|
hsv_image[..., 2] += (255 * chroma)
|
||||||
|
hsv_image[..., 2] = np.clip(hsv_image[..., 2], 0, 255)
|
||||||
|
|
||||||
# Adjust lightness (value)
|
|
||||||
hsv_image[..., 2] = np.clip(hsv_image[..., 2] * lightness, 0, 255)
|
|
||||||
|
|
||||||
return hsv_image
|
return hsv_image
|
||||||
Loading…
Reference in New Issue
Block a user