Skip to content
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

ARW to JPEG conversion script - you can ignore the bilatreral filter part and args, you wont need them #1

Closed
littlerob84 opened this issue Dec 18, 2023 · 2 comments
Assignees

Comments

@littlerob84
Copy link

littlerob84 commented Dec 18, 2023

from PIL import Image, ImageDraw
from easygui import *
import os
import rawpy
import sys
import cv2

# get the desktop path of computer
# desktopPath = os.path.join(os.environ["HOMEPATH"], "Desktop")
pixelLogRootFolder = "C:\\Users\\littl\\Desktop\\OHW Testing Folder\\1cm Test Data\\Blurred Test Folder"
os.chdir(pixelLogRootFolder)

# Photo file picker GUI
PhotoName = fileopenbox(msg="Choose the Image ARW file", title=None)
PhotoNameStripped = PhotoName.rsplit('\\', 1)[-1]

#PhotoName = "C:\\OHW Testing Folder\\1cm Test Data\\Working On Folder\\DSC00829.ARW"
#PhotoNameStripped = PhotoName.rsplit('\\', 1)[-1]

raw = rawpy.imread(PhotoName)
rawRgbnpArrayPreFilter = raw.postprocess(use_camera_wb=True, output_bps=8)

# Apply Blur
# Bilateral filter arg - source, diameter, sigmaColour, sigmaSpace
# sigmaColor – A larger value means that farther colors within the pixel neighborhood will be mixed together
# resulting in larger areas of semi-equal color.
# sigmaSpace – A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor).
# When diameter>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace .
diameter = 0  # 0
sigCol = 25  # 75
sigSpace = 1  # 1

rawRgbnpArray = cv2.bilateralFilter(rawRgbnpArrayPreFilter, diameter, sigCol, sigSpace)

# Save blurred image for testing
blurredimage = Image.fromarray(rawRgbnpArray)
blurredimage.save('AA Blurred - ' + str(diameter) + ", " + str(sigCol) + ", " + str(sigSpace) + ", " + str(PhotoNameStripped) + '.jpg', quality=100, optimize=False)
@NicoMandel
Copy link
Owner

Looks good, I'll integrate this ASAP

@NicoMandel NicoMandel self-assigned this Dec 22, 2023
@NicoMandel
Copy link
Owner

included into code with f70008a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants