<commit_before>#!/usr/bin/env python

# My libraries:
from m_fileio import create, append_to
from m_bitmapClass import BitmapFileHeader, DIBHeader, BMP
from m_filter import attenuate, addNoise
from datetime import datetime


from m_filter import filterBNW
from m_filter import filterEdgeDetect2, filterThreshold
from m_filter import intensity
from math import log, sqrt
from random import random
from statistics import variance
import time

# Adding some project setup parameters to aid in file management
# Test Images to be processed are here:
TEST_IMAGE_FILE_PATH = "../../thesis/test_images/"
# Output files will be saved here:
OUTPUT_FILE_PATH = "../../thesis/output_files/"


# Globals --- YUCK :(
# TEST PARAMETERS:
#SUBWINDOW_SIZE = 100  #was 100
SCAN_RATE = 2  # scan rate in pixels ... how many pixels to jump between subsections
TC1 = (100, [50,25,10,5,2], "TC1")     # (Subwindow_size, Box-count widths)
TC2 = (100, [50,25,10,5,2,1], "TC2")   # (Subwindow_size, Box-count widths)
TC3 = (50, [25,10,5,2], "TC3")         # (Subwindow_size, Box-count widths)
TC4 = (50, [25,10,5,2,1], "TC4")       # (Subwindow_size, Box-count widths)
TESTCASE = TC3
SUBWINDOW_SIZE = TESTCASE[0]
BOXWIDTHS = TESTCASE[1]
TESTCASE_DESCRIPTION = TESTCASE[2] + "_" + str(SCAN_RATE)


COLOR_WHEEL = [(0,0,255), (0,255,0), (255,0,0), (255,255,0), (255,0,255), (0,255,255)]
g_CWINDEX = 0
g_imageID = 10001

WHITE = [255,255,255]
BLACK = [0,0,0]

g_img_header = []
g_pix = []
g_height = 0
g_width = 0
g_padding = 0




# THIS FUNCTION SHOULD BE DEPRECIATED !!!       
def createPixelMatrix( imgdata, width, height):
    """ Create a global array of pixel data from the 'guts' of a .bmp file

    Inputs:
    -- imgdata: The .bmp file raw pixel data array
    -- width: width of image data (stripped from .bmp header)
    -- height: height of image data (stripped from .bmp header)
<commit_msg>Added a getID function that returns a 12 digit ID based on local machines timestamp<commit_after>#!/usr/bin/env python

# My libraries:
from m_fileio import create, append_to
from m_bitmapClass import BitmapFileHeader, DIBHeader, BMP
from m_filter import attenuate, addNoise
from datetime import datetime


from m_filter import filterBNW
from m_filter import filterEdgeDetect2, filterThreshold
from m_filter import intensity
from math import log, sqrt
from random import random
from statistics import variance
import time

# Adding some project setup parameters to aid in file management
# Test Images to be processed are here:
TEST_IMAGE_FILE_PATH = "../../thesis/test_images/"
# Output files will be saved here:
OUTPUT_FILE_PATH = "../../thesis/output_files/"


# Globals --- YUCK :(
# TEST PARAMETERS:
#SUBWINDOW_SIZE = 100  #was 100
SCAN_RATE = 2  # scan rate in pixels ... how many pixels to jump between subsections
TC1 = (100, [50,25,10,5,2], "TC1")     # (Subwindow_size, Box-count widths)
TC2 = (100, [50,25,10,5,2,1], "TC2")   # (Subwindow_size, Box-count widths)
TC3 = (50, [25,10,5,2], "TC3")         # (Subwindow_size, Box-count widths)
TC4 = (50, [25,10,5,2,1], "TC4")       # (Subwindow_size, Box-count widths)
TESTCASE = TC3
SUBWINDOW_SIZE = TESTCASE[0]
BOXWIDTHS = TESTCASE[1]
TESTCASE_DESCRIPTION = TESTCASE[2] + "_" + str(SCAN_RATE)


COLOR_WHEEL = [(0,0,255), (0,255,0), (255,0,0), (255,255,0), (255,0,255), (0,255,255)]
g_CWINDEX = 0
g_imageID = 10001

WHITE = [255,255,255]
BLACK = [0,0,0]

g_img_header = []
g_pix = []
g_height = 0
g_width = 0
g_padding = 0

# ------------------------------------------------
# boxCount() written for Master's Thesis work
# by <NAME>
# on May 12, 2015
# ------------------------------------------------
def getID():
    """ Use local machine datetime to create a 12 digit ID
    Returns a 12 digit ID as a string """
    return datetime.strftime(datetime.now(), '%y%m%d%H%M%S')


# THIS FUNCTION SHOULD BE DEPRECIATED !!!       
def createPixelMatrix( imgdata, width, height):
    """ Create a global array of pixel data from the 'guts' of a .bmp file

    Inputs:
    -- imgdata: The .bmp file raw pixel data array
    -- width: width of image data (stripped from .bmp header)
    -- height: height of image data (stripped from .bmp header)

{'fraction_non_alphanumeric': 0.1424808429118774, 'fraction_numerical': 0.05890804597701149, 'mean_word_length': 3.6932584269662923, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2846583', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1417, 'n_words': 471}