Пример #1
0
	// ---------------------
	CTexture* apply(CTexture* input, float global_distance, VEC4 distances, VEC4 weights, const CRenderTechnique* technique) {
		float normalization_factor =
			1 * weights.x
			+ 2 * weights.y
			+ 2 * weights.z
			+ 2 * weights.w
			;
		shader_ctes_blur.blur_w.x = weights.x / normalization_factor;
		shader_ctes_blur.blur_w.y = weights.y / normalization_factor;
		shader_ctes_blur.blur_w.z = weights.z / normalization_factor;
		shader_ctes_blur.blur_w.w = weights.w / normalization_factor;
		shader_ctes_blur.blur_d.x = distances.x;
		shader_ctes_blur.blur_d.y = distances.y;
		shader_ctes_blur.blur_d.z = distances.z;
		shader_ctes_blur.blur_d.w = distances.w;  // Not used

		auto tech = Resources.get("solid_textured.tech")->as<CRenderTechnique>();
		tech->activate();

		rt_half_y->activateRT();
		input->activate(TEXTURE_SLOT_DIFFUSE);
		applyBlur(0, global_distance, technique);

		rt_output->activateRT();
		rt_half_y->activate(TEXTURE_SLOT_DIFFUSE);
		applyBlur(global_distance, 0, technique);

		return rt_output;
	}
Пример #2
0
int IPS_simple::processBlur(){
    //Raw Image
    Mat src = imread( Constants::IMG_RAW_LAPLACE );
    if (!src.data) return 1;
    Mat dst = applyBlur(src);
    imwrite( Constants::IMG_RAW_BLUR, dst );

    //Ref Image
    src = imread( Constants::IMG_REF_LAPLACE );
    if (!src.data) return 1;
    dst = applyBlur(src);
    imwrite( Constants::IMG_REF_BLUR, dst );
    return 0;
}
Пример #3
0
Mat IPS_simple::applyContourns(Mat src){
    vector<vector<Point> > contours;
    vector<Vec4i> hierarchy;
    RNG rng(12345);
    Mat src2 = src.clone();
    Mat dst = src.clone();
    Mat src_gray = src.clone();
    Mat final = imread(Constants::IMG_RAW);

    cvtColor( src, src_gray, CV_BGR2GRAY );
    // Eliminar ruido
    src2 = applyBlur(src_gray);
    findContours( src2, contours, hierarchy,CV_CHAIN_APPROX_SIMPLE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );

    qDebug() << contours.data();
    // Rotar los rectangulos buscando el area minima
    vector<RotatedRect> minRect( contours.size() );
    for( int i = 0; i < contours.size(); i++ ){
         minRect[i] = minAreaRect( Mat(contours[i]) );
     }

    //  Dibujar rectangulos
     Scalar color = Scalar( rng.uniform(0,0), rng.uniform(250,250), rng.uniform(0,0) );
     for( int i = 0; i< contours.size(); i++ ){
         Point2f rect_points[4]; minRect[i].points( rect_points );

         if( pow((int)(rect_points[0].x-(rect_points[1]).x), 2.0) + pow((int)(rect_points[0].y-(rect_points[1]).y), 2.0) > pow(Constants::CONTOURS_MIN_CONTOURS, 2.0) &&
             pow((int)(rect_points[1].x-(rect_points[2]).x), 2.0) + pow((int)(rect_points[1].y-(rect_points[2]).y), 2.0) > pow(Constants::CONTOURS_MIN_CONTOURS, 2.0))
             {
            for(int j = 0; j < 4; j++ ){
                line( dst, rect_points[j], rect_points[(j+1)%4], color, 2, 8 );
                line( final, rect_points[j], rect_points[(j+1)%4], color, 2, 8 );
            }
         }
     }
     imwrite(Constants::IMG_FINAL,final);
    return dst;
}
Пример #4
0
void Java_com_lightbox_android_photoprocessing_PhotoProcessing_nativeApplyBlur(JNIEnv* env, jobject thiz, jint radius) {
	applyBlur(&bitmap, radius);
}