Example #1
0
 std::vector<float3> stgauss3_path_( int ix, int iy, const cpu_image& st, float sigma,
                                    bool st_linear, bool adaptive, bool ustep,
                                    int order, float step_size )
 {
     cpu_sampler<float3> st_sampler(st, st_linear? cudaFilterModeLinear : cudaFilterModePoint);
     float2 p0 = make_float2(ix + 0.5f, iy + 0.5f);
     filter_path f(2 * sigma);
     if (!ustep) {
         if (order == 1) {
             if (adaptive)
                 st3_int<cpu_sampler<float3>,filter_path,1,true>(p0, st_sampler, f, st.w(), st.h(), step_size);
             else
                 st3_int<cpu_sampler<float3>,filter_path,1,false>(p0, st_sampler, f, st.w(), st.h(), step_size);
         } else {
             if (adaptive)
                 st3_int<cpu_sampler<float3>,filter_path,2,true>(p0, st_sampler, f, st.w(), st.h(), step_size);
             else
                 st3_int<cpu_sampler<float3>,filter_path,2,false>(p0, st_sampler, f, st.w(), st.h(), step_size);
         }
     } else {
         if (order == 1) {
             st3_int_ustep<cpu_sampler<float3>,filter_path,1>(p0, st_sampler, f, st.w(), st.h(), step_size);
         } else {
             st3_int_ustep<cpu_sampler<float3>,filter_path,2>(p0, st_sampler, f, st.w(), st.h(), step_size);
         }
     }
     return f.path();
 }
Example #2
0
std::vector<float3> gpu_stgauss2_path( int ix, int iy, const cpu_image<float4>& st, float sigma, float max_angle, 
                                       bool adaptive, bool st_linear, int order, float step_size )
{
    cpu_sampler<float4> st_sampler(st, st_linear? cudaFilterModeLinear : cudaFilterModePoint);
    float2 p0 = make_float2(ix + 0.5f, iy + 0.5f);
    if (adaptive) {
        float A = st2A(st(p0.x, p0.y));
        sigma *= 0.25f * (1 + A)*(1 + A);
    }
    std::deque<float3> C;
    float cos_max = cosf(radians(max_angle));
    stgauss2_path f(C, sigma);
    if (order == 1) st_integrate_euler(p0, st_sampler, f, cos_max, st.w(), st.h(), step_size);
    if (order == 2) st_integrate_rk2(p0, st_sampler, f, cos_max, st.w(), st.h(), step_size);
    if (order == 4) st_integrate_rk4(p0, st_sampler, f, cos_max, st.w(), st.h(), step_size);
    
    return std::vector<float3>(C.begin(), C.end());
}
Example #3
0
oz::gpu_image::gpu_image( const cpu_image& img ) : d_(0) {
    operator=(img.gpu());
}