Unverified Commit 190faf55 authored by tilman's avatar tilman
Browse files

add background foreground seperation

parent c7f19c9c
This diff is collapsed.
import cv2 import cv2
import numpy as np import numpy as np
# out = cv2.imread('../images/images_imdahl/Giotto_di_Bondone_-_Joachims_Dream_-_Capella_degli_Scrovegni.jpg') # out = cv2.imread('../images/images_imdahl/Giotto_di_Bondone_-_Joachims_Dream_-_Capella_degli_Scrovegni.jpg')
out = cv2.imread('/Users/Tilman/Documents/Programme/Python/forschungspraktikum/art-structures-env/src/images/out/images_imdahl/kmeans_output_canvas/new2/658px-Giotto_di_Bondone_-_No._3_Scenes_from_the_Life_of_Joachim_-_3._Annunciation_to_St_Anne_-_WGA09171.png_kmeans_temp_save_after.jpg') out = cv2.imread('/Users/Tilman/Documents/Programme/Python/forschungspraktikum/art-structures-env/src/images/out/images_imdahl/kmeans_output_canvas/final/658px-Giotto_di_Bondone_-_No._3_Scenes_from_the_Life_of_Joachim_-_3._Annunciation_to_St_Anne_-_WGA09171.jpg_inkm_step5_kmean_binarization.jpg')
# out = cv2.GaussianBlur(out,(5,5),0) # out = cv2.GaussianBlur(out,(5,5),0)
# out = cv2.medianBlur(out,3) #smoothen cracks # out = cv2.medianBlur(out,3) #smoothen cracks
out = cv2.medianBlur(out,13) #smoothen cracks #remove small kmeans fragments
out = cv2.bilateralFilter(out,30,60,60) #remove cracks kernel = np.array([
out = cv2.medianBlur(out,13) #smoothen cracks [0,0,1,0,0],
[0,1,1,1,0],
[0.5,1,1,1,1],
[0,1,1,1,0],
[0,0,0.5,0,0]], dtype=np.uint8)
# out = cv2.medianBlur(out,53)
# out = cv2.medianBlur(out,53)
out = cv2.erode(out,kernel,iterations = 10)
out = cv2.dilate(out,kernel,iterations = 10)
out = cv2.dilate(out,kernel,iterations = 10)
out = cv2.erode(out,kernel,iterations = 10)
# out = cv2.bilateralFilter(out,20,60,60)
# out = cv2.medianBlur(out,7)
# out = cv2.medianBlur(out,13) #smoothen cracks # out = cv2.medianBlur(out,13) #smoothen cracks
# out = cv2.bilateralFilter(out,30,90,90) #remove cracks # out = cv2.bilateralFilter(out,30,90,90) #remove cracks
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment