-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not see code convert laplace for image #6
Comments
Same question about the LPLS convert process. |
Same problem |
I have implementation LPLS convert process, but image can't not correct with dataset public but they can use. Hope the author public code
import cv2
import os
from tqdm import tqdm
def apply_laplacian_filter(img):
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# Apply high pass filter Laplacian
edge = cv2.Laplacian(img, -1, ksize=3, scale=1.5, delta=0.2,
borderType=cv2.BORDER_DEFAULT
)
return edge
def binarize_image(img, threshold=128):
_, img = cv2.threshold(img, threshold, 255, cv2.THRESH_BINARY)
return img
def save_image(save_dir, img_dir):
# read subdirectories
for root, dirs, files in tqdm(os.walk(img_dir), desc="Processing directories"):
img_ext = [".jpg", ".png", ".jpeg"]
files = [file for file in files if file.endswith(tuple(img_ext))]
for file in files:
img_path = os.path.join(root, file)
img = cv2.imread(img_path)
high_pass_filter = apply_laplacian_filter(img)
high_pass_filter = binarize_image(high_pass_filter)
relative_path = os.path.relpath(root, img_dir)
target_dir = os.path.join(save_dir, relative_path)
os.makedirs(target_dir, exist_ok=True)
save_path = os.path.join(target_dir, file)
cv2.imwrite(save_path, high_pass_filter)
# cv2.imshow(f"{os.path.basename(img_path)}", high_pass_filter)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
if __name__ == "__main__":
img_dir = "../data/RIMES-new"
save_dir = img_dir.replace("-new", "_laplace")
# img_dir = "../data/IAM64-new"
# save_dir = img_dir + "_laplace"
os.makedirs(save_dir, exist_ok=True)
save_image(save_dir, img_dir) |
Thanks for your attention! We provide the Laplace image implementation below:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find the file to convert image to lap_ref but don't see that. You can public this file, I try to use opencv but they not same output you return
The text was updated successfully, but these errors were encountered: