<jupyter_start><jupyter_text>Test 1<jupyter_code>pre_image = gray_image.copy()

edges = cv2.Canny(pre_image,130,130)
edges = cv2.dilate(edges, None)

plt.subplot(121),plt.imshow(img,cmap = 'gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap = 'gray')
plt.title('Edge Image'), plt.xticks([]), plt.yticks([])<jupyter_output><empty_output><jupyter_text>Test 2<jupyter_code>pre_image = cv2.GaussianBlur(gray_image,(3,3),0)
laplacian = cv2.Laplacian(pre_image,cv2.CV_64F)
sobelx = cv2.Sobel(pre_image,cv2.CV_64F,1,0,ksize=5)  # x
sobely = cv2.Sobel(pre_image,cv2.CV_64F,0,1,ksize=5)  # y

ret,thresh1 = cv2.threshold(laplacian,15,255,cv2.THRESH_BINARY)

plt.subplot(2,2,1),plt.imshow(img,cmap = 'gray')
plt.title('Original'), plt.xticks([]), plt.yticks([])
plt.subplot(2,2,2),plt.imshow(thresh1,cmap = 'gray')
plt.title('Laplacian'), plt.xticks([]), plt.yticks([])
plt.subplot(2,2,3),plt.imshow(sobelx,cmap = 'gray')
plt.title('Sobel X'), plt.xticks([]), plt.yticks([])
plt.subplot(2,2,4),plt.imshow(sobely,cmap = 'gray')
plt.title('Sobel Y'), plt.xticks([]), plt.yticks([])

plt.show()<jupyter_output><empty_output><jupyter_text>Test 3<jupyter_code>gray_image = cv2.cvtColor(res, cv2.COLOR_RGB2GRAY)
plt.imshow(gray_image, cmap='gray')
sigma = 0.33
#---- apply automatic Canny edge detection using the computed median----
lower = int(max(0, (1.0 - sigma) * sigma))
upper = int(min(255, (1.0 + sigma) * sigma))
print('lower : ',lower, 'upper', upper)
edges = cv2.Canny(gray_image,130,130)
edges = cv2.dilate(edges, None)

plt.subplot(121),plt.imshow(img,cmap = 'gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap = 'gray')
plt.title('Edge Image'), plt.xticks([]), plt.yticks([])
laplacian = cv2.Laplacian(gray_image,cv2.CV_64F)
sobelx = cv2.Sobel(gray_image,cv2.CV_64F,1,0,ksize=5)
plt.imshow(laplacian, cmap='gray')
sobelx.max()
kernel = np.ones([4, 4], np.float32)/16
blur = cv2.filter2D(gray_image, -1, kernel)

laplacian = cv2.Laplacian(blur,cv2.CV_64F)
threshold = 5
laplacian[laplacian<threshold] = 0
laplacian[laplacian>threshold] = 255

laplacian = cv2.dilate(laplacian, None)
plt.imshow(laplacian, cmap='gray')
laplacian.max()
s = img.copy()
gray_image = cv2.cvtColor(s, cv2.COLOR_RGB2GRAY)
plt.imshow(gray_image)
high_thresh, thresh_im = cv2.threshold(gray_image, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
lowThresh = 0.5*high_thresh

edged = cv2.Canny(gray_image, lowThresh, high_thresh)
double otsu_thresold = Imgproc.threshold(mGray,edged,0,255, Imgproc.THRESH_OTSU);
Imgproc.Canny(mRgba, edged, otsu_thresold*0.5,otsu_thresold);
plt.imshow(edged)
s = img.copy()
plt.imshow(s)
res = cv2.bitwise_and(s,s, mask= mask)
gray_image = cv2.cvtColor(res, cv2.COLOR_RGB2GRAY)
v = np.median(gray_image)

sigma = 0.33
#---- apply automatic Canny edge detection using the computed median----
lower = int(max(0, (1.0 - sigma) * v))
upper = int(min(255, (1.0 + sigma) * v))
edged = cv2.Canny(gray_image, lower, upper)
cv2.imshow('Edges',edged)
plt.imshow(edged, cmap='gray')

gray_image = cv2.cvtColor(res, cv2.COLOR_RGB2GRAY)
blurred = cv2.GaussianBlur(gray_image, (3, 3), 0)
v = np.median(gray_image)

#---- apply automatic Canny edge detection using the computed median----
sigma=0.33
lower = int(max(0, (1.0 - sigma) * v))
upper = int(min(255, (1.0 + sigma) * v))
edged = cv2.Canny(blurred, 200, 201)
plt.imshow(edged, cmap='gray')
result, thresh = cv2.threshold(edge_mask,127,255,cv2.THRESH_BINARY_INV)

plt.imshow(edge_mask, cmap='gray')
result, thresh = cv2.threshold(edge_mask,127,255,cv2.THRESH_BINARY_INV)
plt.imshow(thresh, cmap='gray')
mean = np.mean(edgeImg);
# Zero any value that is less than mean. This reduces a lot of noise.
edgeImg[edgeImg <= mean] = 0;<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18482541349435547, 'fraction_numerical': 0.05145707534786033, 'mean_word_length': 6.589641434262949, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '320097', 'license': 'Apache-2.0', 'n_tokens_mistral': 1803, 'n_tokens_neox': 1649, 'n_words': 263, 'path': 'pretraining/.ipynb_checkpoints/Untitled-checkpoint.ipynb', 'repo_name': 'Artia-Inspirenet/module-2', 'size': '3809'}