Пример #1
0
void had::SingleLCM::computeModel( const cv::Mat& image,
                                   const cv::Mat& mask )
{
    // See Horprasert et al., 1999, Section 4.1
    computeModelMeanStdDev( image, mask );
    computeVariations( image, mask );

    if( _trace )
    {
        std::cerr << "mean: B=" << _mean[ 0 ] << " G=" << _mean[ 1 ] << " R=" << _mean[ 2 ] << std::endl;
        std::cerr << "stddev: B=" << _stddev[ 0 ] << " G=" << _stddev[ 1 ] << " R=" << _stddev[ 2 ] << std::endl;
        showImage( "lcm mask", mask * 255, 1, 0 );
    }

    cv::Mat bdist_norm, cdist_norm;
    computeNormalizedDistortions( image, bdist_norm, cdist_norm );

    selectThresholds( _detection_rate,
                      bdist_norm,
                      cdist_norm,
                      &_threshold_cdist,
                      &_threshold_bdist_left,
                      &_threshold_bdist_right
                    );
}
Пример #2
0
void DivePlannerPointsModel::createTemporaryPlan()
{
	// Get the user-input and calculate the dive info
	free_dps(&diveplan);
	int lastIndex = -1;
	for (int i = 0; i < rowCount(); i++) {
		divedatapoint p = at(i);
		int deltaT = lastIndex != -1 ? p.time - at(lastIndex).time : p.time;
		lastIndex = i;
		if (i == 0 && mode == PLAN && prefs.drop_stone_mode) {
			/* Okay, we add a first segment where we go down to depth */
			plan_add_segment(&diveplan, p.depth.mm / prefs.descrate, p.depth.mm, p.cylinderid, p.setpoint, true);
			deltaT -= p.depth.mm / prefs.descrate;
		}
		if (p.entered)
			plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true);
	}

	// what does the cache do???
	struct deco_state *cache = NULL;
	struct divedatapoint *dp = NULL;
	for (int i = 0; i < MAX_CYLINDERS; i++) {
		cylinder_t *cyl = &displayed_dive.cylinder[i];
		if (cyl->depth.mm && cyl->cylinder_use != NOT_USED) {
			dp = create_dp(0, cyl->depth.mm, i, 0);
			if (diveplan.dp) {
				dp->next = diveplan.dp;
				diveplan.dp = dp;
			} else {
				dp->next = NULL;
				diveplan.dp = dp;
			}
		}
	}
#if DEBUG_PLAN
	dump_plan(&diveplan);
#endif
	if (recalcQ() && !diveplan_empty(&diveplan)) {
		struct decostop stoptable[60];
		plan(&diveplan, &displayed_dive, DECOTIMESTEP, stoptable, &cache, isPlanner(), false);
		computeVariations();
		emit calculatedPlanNotes();
	}
	// throw away the cache
	free(cache);
#if DEBUG_PLAN
	save_dive(stderr, &displayed_dive);
	dump_plan(&diveplan);
#endif
}