<commit_before>import numpy as np
import cv2
import sys
from time import sleep

# mad props to http://stackoverflow.com/questions/11424002/how-to-detect-simple-geometric-shapes-using-opencv

def confirm_illuminati (file_name):
  num_illuminati_found = 0
  copy = img = cv2.imread(file_name, cv2.IMREAD_COLOR)
  grey_img = cv2.imread(file_name, cv2.IMREAD_GRAYSCALE)

  ret, thresh = cv2.threshold(grey_img, 127, 255, 1)

  contours, h = cv2.findContours(thresh, 1, 2)

  FIRST = 0
  RED = (0, 0, 255)
  THICKNESS = 3

  for some_contour in contours:
    approx = cv2.approxPolyDP(some_contour, 0.01*cv2.arcLength(some_contour, True), True)
    l = len(approx)

    if l == 3:
      print 'ILLUMINATI CONFIRMED!'
      num_illuminati_found += 1
      cv2.drawContours(copy, [some_contour], FIRST, RED, 3)

  cv2.imwrite(file_name[:-4] + '_result.jpg', copy)
  return num_illuminati_found

### MAIN PROGRAM BELOW ###

print '---> executing: hack illuminati'
sleep(3)
print 'running illuminati.exe'
sleep(1)
illuminati_count = 0

for file_index in range(1, len(sys.argv)):
  file_name = sys.argv[file_index]
  print 'Processing meme: ' + file_name
  illuminati_count += confirm_illuminati(file_name)

print 'Congratulation, you have rekt the Illuminate'
print 'You have identified ' + str(illuminati_count) + ' of [REDACTED] total Illuminati'<commit_msg>Only drawing largest found (triangle) contour<commit_after>import numpy as np
import cv2
import sys
from time import sleep

# mad props to http://stackoverflow.com/questions/11424002/how-to-detect-simple-geometric-shapes-using-opencv

def confirm_illuminati (file_name):
  num_illuminati_found = 0
  copy = img = cv2.imread(file_name, cv2.IMREAD_COLOR)
  grey_img = cv2.imread(file_name, cv2.IMREAD_GRAYSCALE)

  ret, thresh = cv2.threshold(grey_img, 127, 255, 1)

  contours, h = cv2.findContours(thresh, 1, 2)

  FIRST = 0
  RED = (0, 0, 255)
  THICKNESS = 3

  largest_contour = None

  for some_contour in contours:
    approx = cv2.approxPolyDP(some_contour, 0.01*cv2.arcLength(some_contour, True), True)
    l = len(approx)

    # if we find a triangle
    if l == 3:
      print 'ILLUMINATI CONFIRMED!'
      num_illuminati_found += 1
      if largest_contour is None or cv2.contourArea(some_contour) > cv2.contourArea(largest_contour):
        largest_contour = some_contour

  cv2.drawContours(copy, [largest_contour], FIRST, RED, THICKNESS)
  cv2.imwrite(file_name[:-4] + '_result.jpg', copy)
  return num_illuminati_found

### MAIN PROGRAM BELOW ###

print '---> executing: hack illuminati'
sleep(3)
print 'running illuminati.exe'
sleep(1)
illuminati_count = 0

for file_index in range(1, len(sys.argv)):
  file_name = sys.argv[file_index]
  print 'Processing meme: ' + file_name
  illuminati_count += confirm_illuminati(file_name)

print 'Congratulation, you have rekt the Illuminate'
print 'You have identified ' + str(illuminati_count) + ' of [REDACTED] total Illuminati'
{'fraction_non_alphanumeric': 0.11001362397820164, 'fraction_numerical': 0.03235694822888283, 'mean_word_length': 4.448979591836735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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}}
{'dir': 'git-commits-cleaned', 'id': '776586', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1073, 'n_words': 258}