Skip to content
Permalink
Browse files

tutorials completed

  • Loading branch information...
mluerig committed Feb 15, 2019
1 parent 229d445 commit 066b4929ce657e20a500cd0684b5efda46511dcb
@@ -1,8 +1,22 @@
Unreleased
==========

- testing environment for package release (tox?)
- call object_finder functions from external script
- internal: decluttering of base module / outhousing of classes and methods
- no cropping for scale possible
- project management globally acessible through base functions
- a quick-thresholding method in marked area for single images
- object_finder returns histogram of length, area and grayscale of all objects

0.6.0
------
- integration with opencv-contrib-python==3.4.5.20
- tracking functionality added, integration with trackpy
- testing environment in place, integration with pytest
- initialize classes directly with image
- tutorials included for basic python (1) and object finding (2)
Known bugs:
- base "fillyPoly" sometimes breaks - culprit numpy datatype?
- base.polygon_maker "include=False" excludes everything


0.5.1
File renamed without changes.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

@@ -184,12 +184,12 @@ def run_tracking(self, **kwargs):
# =============================================================================
# CAPTURE FRAME
# =============================================================================
if capture_frame == True:

if capture_frame == True:
# apply mask, if present
if "mask_objects" in vars(self):

mask_dummy1 = np.zeros(self.frame.shape[0:2], dtype=bool)
mask_dummy1 = np.zeros(self.frame.shape[0:2], dtype=np.int8)
mask_list = []
mask_label_names = []

@@ -198,11 +198,11 @@ def run_tracking(self, **kwargs):
if include == True:
mask_list.append(mask)
mask_label_names.append(label)
mask_dummy2 = np.zeros(self.frame.shape[0:2], dtype=np.uint8)
mask_dummy2 = np.zeros(self.frame.shape[0:2], dtype=np.int8)
mask_dummy2[mask] = 1
mask_dummy1 = np.add(mask_dummy1, mask_dummy2)
if include == False:
mask_dummy2 = np.zeros(self.frame.shape[0:2], dtype=np.uint8)
mask_dummy2 = np.zeros(self.frame.shape[0:2], dtype=np.int8)
mask_dummy2[mask] = -100
mask_dummy1 = np.add(mask_dummy1, mask_dummy2)

@@ -1,3 +1,4 @@
import os
import cv2
import numpy as np
import exifread
@@ -110,7 +111,54 @@ def get_median_grayscale(image, **kwargs):
#
# if write == True:
# self.df["gray_scale"] = self.gray_scale_list
#%% save functions

def save_csv(df, name, save_dir, **kwargs):
"""Save a pandas dataframe to csv.
"""
out_dir = save_dir
if not os.path.exists(out_dir):
os.makedirs(out_dir)

if "append" in kwargs:
app = '_' + kwargs.get('append',"objects")
else:
app = ""

df_path=os.path.join(out_dir , name + app + ".txt")
df = df.fillna(-9999)
df = df.astype(str)
if kwargs.get('overwrite',True) == False:
if not os.path.exists(df_path):
df.to_csv(path_or_buf=df_path, sep=",")

else:
df.to_csv(path_or_buf=df_path, sep=",")


def save_img(image, name, save_dir, **kwargs):
"""Save an image (array) to jpg.
"""
# set dir and names
out_dir = save_dir
if not os.path.exists(out_dir):
os.makedirs(out_dir)

if "append" in kwargs:
app = '_' + kwargs.get('append',"processed")
else:
app = ""


im_path=os.path.join(out_dir , name + app + ".jpg")

if "resize" in kwargs:
factor = kwargs.get('resize')
image = cv2.resize(image, (0,0), fx=1*factor, fy=1*factor)

if kwargs.get('overwrite',True) == False:
if not os.path.exists(im_path):
cv2.imwrite(im_path, image)
else:
cv2.imwrite(im_path, image)


@@ -0,0 +1,7 @@
exifread==2.1.2
numpy==1.16.1
pandas==0.24.1
pytesseract==0.2.6
pytest==4.2.0
opencv-contrib-python==3.4.5.20
trackpy==0.4.1

0 comments on commit 066b492

Please sign in to comment.
You can’t perform that action at this time.