Beispiel #1
0
def experiment(*, max_count, drift_velocity, drift_angle, **kwargs):

    sv = StrandVideo(angle_velocity=0)
    N = len(sv.frames)

    corr_sum = correlate_and_sum(sv.frames)

    drift_new1, d = guizar_multiframe(corr_sum, start=1, end=N)
    drift_old = np.mean(d[9:29], axis=0)

    drift_new2 = guizar_upsample(corr_sum)[0]

    # import ipdb
    # ipdb.set_trace()

    return {
        'error_old': np.linalg.norm(sv.true_drift - drift_old),
        'error_new1': np.linalg.norm(sv.true_drift - drift_new1),
        'error_new2': np.linalg.norm(sv.true_drift - drift_new2),
        'drift_old': drift_old,
        'drift_new1': drift_new1,
        'drift_new2': drift_new2,
        'errorv_old': sv.true_drift - drift_old,
        'errorv_new1': sv.true_drift - drift_new1,
        'errorv_new2': sv.true_drift - drift_new2,
        'd': d,
        'd_err': np.linalg.norm(sv.true_drift - d, axis=1),
        'true_drift': sv.true_drift
    }
Beispiel #2
0
def experiment(*, max_count, background_noise, drift_velocity):

    # noise
    noise_model = get_visors_noise(background=background_noise)
    sv = StrandVideo(
        scene=scene,
        max_count=max_count,
        noise_model=noise_model,
        drift_velocity=drift_velocity * 1e-3,
    )
    noise = sv.frames - sv.frames_clean

    # register
    corr_sum = correlate_and_sum(sv.frames)
    drift, _ = guizar_multiframe(corr_sum)

    # reconstruct
    recon = shift_and_sum(sv.frames, drift, mode='crop')
    noise_recon = shift_and_sum(noise, drift, mode='crop')

    result = resize(recon, (300, 300))

    snr_db = 10 * np.log10(
        np.sum((recon - noise_recon)**2) / np.sum(noise_recon**2))

    return {
        'result': result,
        'est_drift': drift,
        'true_drift': sv.true_drift,
        'snr_db': snr_db,
    }
Beispiel #3
0
def experiment(*, max_count, background_noise, drift_velocity, frame_rate):

    # noise
    noise_model = get_visors_noise(background=background_noise)
    sv = StrandVideo(
        ccd_size=size,
        start=((1400, 1300)),
        scene=scene,
        max_count=max_count,
        noise_model=noise_model,
        drift_velocity=drift_velocity * 1e-3,
        resolution_ratio=resolution_ratio,
        fov_ratio=fov_ratio,
        frame_rate=frame_rate
    )

    # register
    corr_sum = correlate_and_sum(sv.frames)
    drift, _ = guizar_multiframe(corr_sum)
    # drift_u, _ = guizar_upsample(corr_sum)

    # reconstruct
    coadded = shift_and_sum(sv.frames, drift, mode='crop')
    coadded = resize(coadded, (300, 300))

    frame = resize(sv.frames[0], (300, 300))

    return {
        'coadded': coadded,
        'frame': frame,
        'est_drift': drift,
        # 'est_drift_u': drift_u,
        'true_drift': sv.true_drift,
        # 'd': d
    }
def experiment(*, drift_velocity, drift_angle, max_count):
    sv = StrandVideo(
        drift_velocity=drift_velocity,
        max_count=max_count,
        drift_angle=drift_angle
    )

    corr_sum = correlate_and_sum3(sv.frames)
    gm, d = guizar_multiframe2(corr_sum, start=1, end=39)

    return {
        'component_errors': np.linalg.norm(sv.true_drift - d, axis=1)
    }
Beispiel #5
0
def experiment(*, max_count, drift_velocity, drift_angle, **kwargs):

    sv = StrandVideo(
        max_count=max_count,
        drift_velocity=drift_velocity,
        drift_angle=drift_angle
    )

    corr_sum = correlate_and_sum3(sv.frames)

    guizar_drift, d = guizar_multiframe2(corr_sum, start=10, end=30)
    ulas_drift1, ulas_drift2 = ulas_multiframe3(corr_sum)

    return {
        'guizar_error': np.linalg.norm(sv.true_drift - guizar_drift),
        'guizar_drift': guizar_drift,
        'ulas_error1': np.linalg.norm(sv.true_drift - ulas_drift1),
        'ulas_error2': np.linalg.norm(sv.true_drift - ulas_drift2),
        'ulas_drift1': ulas_drift1,
        'ulas_drift2': ulas_drift2,
        'd': np.linalg.norm(sv.true_drift - d, axis=1),
        'true_drift': sv.true_drift
    }
Beispiel #6
0
from skimage.transform import resize
from mas.strand_generator import StrandVideo, get_visors_noise
from mas.tracking import guizar_multiframe, correlate_and_sum, shift_and_sum
from mas.misc import combination_experiment
from html_slider.html_slider import render_pandas
import numpy as np

scene = StrandVideo(noise_model=None).scene


def experiment(*, max_count, background_noise, drift_velocity):

    # noise
    noise_model = get_visors_noise(background=background_noise)
    sv = StrandVideo(
        scene=scene,
        max_count=max_count,
        noise_model=noise_model,
        drift_velocity=drift_velocity * 1e-3,
    )
    noise = sv.frames - sv.frames_clean

    # register
    corr_sum = correlate_and_sum(sv.frames)
    drift, _ = guizar_multiframe(corr_sum)

    # reconstruct
    recon = shift_and_sum(sv.frames, drift, mode='crop')
    noise_recon = shift_and_sum(noise, drift, mode='crop')

    result = resize(recon, (300, 300))