def test_running(): plant_number = 1 voxels_size = 16 bin_images = phm_data.bin_images(plant_number=plant_number) calibrations = phm_data.calibrations(plant_number=plant_number) voxel_grid = phm_data.voxel_grid(plant_number=plant_number, voxels_size=voxels_size) graph = phm_seg.graph_from_voxel_grid(voxel_grid) voxel_skeleton = phm_seg.skeletonize(voxel_grid, graph) image_projection = list() for angle in [0, 120, 270]: projection = calibrations["side"].get_projection(angle) image_projection.append((bin_images["side"][angle], projection)) voxel_skeleton_reduced = phm_seg.segment_reduction(voxel_skeleton, image_projection, required_visible=1, nb_min_pixel=100)
def test_running(): bin_images = phm_data.bin_images(plant_1_dir) calibrations = phm_data.calibrations(plant_1_dir) voxel_grid = phm_data.voxel_grid(data_dir, 1, 32) # Load images binarize graph = phm_seg.graph_from_voxel_grid(voxel_grid) voxel_skeleton = phm_seg.skeletonize(voxel_grid, graph) image_projection = list() for angle in [0, 120, 270]: projection = calibrations["side"].get_projection(angle) image_projection.append((bin_images["side"][angle], projection)) voxel_skeleton = phm_seg.segment_reduction( voxel_skeleton, image_projection, required_visible=1, nb_min_pixel=100)
def test_reconstruction_3d_1(): # Load images binarize bin_images = phm_data.bin_images(plant_1_dir) calibrations = phm_data.calibrations(plant_1_dir) image_views = list() for id_camera in bin_images: for angle in bin_images[id_camera]: projection = calibrations[id_camera].get_projection(angle) iv = phm_obj.ImageView(bin_images[id_camera][angle], projection, inclusive=False, image_ref=None) image_views.append(iv) voxels_size = 64 error_tolerance = 0 vg = phm_mvr.reconstruction_3d(image_views, voxels_size=voxels_size, error_tolerance=error_tolerance) assert len(vg.voxels_position) > 0
#!/usr/bin/env python import sys import pickle import openalea.phenomenal.data as phm_data import json import pandas output_files = { 'bin_images': '/home/ubuntu/multiviewReconstruction/bin_images.pkl', 'calibrations': '/home/ubuntu/multiviewReconstruction/calibrations.pkl' } plant_number = 2 # Available : 1, 2, 3, 4 or 5 bin_images = phm_data.bin_images(plant_number=plant_number) calibrations = phm_data.calibrations(plant_number=plant_number) with open(output_files['bin_images'], 'w') as fd: pickle.dump(bin_images, fd) with open(output_files['calibrations'], 'w') as fd: pickle.dump(calibrations, fd) print('{}\n{}\n{}'.format(plant_number, output_files['bin_images'], output_files['calibrations']))