...
 
Commits (2)
......@@ -16,7 +16,7 @@ This way the midline and angles are always with respect to the nose of the anima
![GIF_1](fishmidline/scripts/midline_nose.gif)
I invite users to code their our nose and tail detectors. If the developer requires information about the inner structure of the body of the animals, the pixel values of the segmented blob can be extracted from the *blob_collection_segmented.py* (in the preprocessing folder of [idtracker.ai](idtracker.ai) or from the frame of the original video.
I invite users to code their our nose and tail detectors. If the developer requires information about the inner structure of the body of the animals, the pixel values of the segmented blob can be extracted from the *blob_collection_segmented.py* (in the preprocessing folder of [idtracker.ai](idtracker.ai) or from the frame of the original video.
## Requirements
......@@ -31,7 +31,9 @@ I invite users to code their our nose and tail detectors. If the developer requi
## TODO
* Optimize
* Optimize:
* Currently all the operations are performed on the whole frame. This is very expensive. The best would be to work on a bounding box arond the blob and then translate the midline to the full-frame coordinates
* Also the function to prune the skeleton is pretty slow. Maybe find a better way of prunning the skeleton.
* Eignenvalues
* Eignenshapes
......
......@@ -90,7 +90,7 @@ def get_midline_angles(video, blob, plot_flag=False,
# Skeletonize segmented image
skeleton = skeletonize(binary_image.astype(bool))
# Prune skeleton
skeleton, end_points = pruning(skeleton, 3)
skeleton, end_points = pruning(skeleton, 1)
# Extract midline and order points in midline
midline_y, midline_x = np.where(skeleton == 1)
if use_nose:
......
......@@ -51,3 +51,8 @@ if __name__ == '__main__':
else:
all_angles[frame_number, blob.identity - 1,
:len(angles)] = angles[:all_angles.shape[2]]
save_folder = os.path.join(session_path, 'angles')
if not os.path.isdir(save_folder):
os.makedirs(save_folder)
np.save(os.path.join(save_folder, 'midline_angles.npy'), all_angles)