void RayTracer::Init() { // Scene Setup -- Generate the camera and scene. currentCamera = storedApplication->CreateCamera(); currentScene = storedApplication->CreateScene(); currentSampler = storedApplication->CreateSampler(); currentRenderer = storedApplication->CreateRenderer(currentScene, currentSampler); assert(currentScene && currentCamera && currentSampler && currentRenderer); currentSampler->InitializeSampler(storedApplication.get(), currentScene.get()); // Scene preprocessing -- generate acceleration structures, etc. // After this call, we are guaranteed that the "acceleration" member of the scene and all scene objects within the scene will be non-NULL. currentScene->GenerateDefaultAccelerationData(); currentScene->Finalize(); currentRenderer->InitializeRenderer(); // Prepare for Output currentResolution = storedApplication->GetImageOutputResolution(); imageWriter = ImageWriter(storedApplication->GetOutputFilename(), static_cast<int>(currentResolution.x), static_cast<int>(currentResolution.y)); // Perform forward ray tracing maxSamplesPerPixel = storedApplication->GetSamplesPerPixel(); assert(maxSamplesPerPixel >= 1); }
int Test_Write() { Frame IFrame = ImageReader("D:\\Test Images\\BM3D\\_DSC8263.1noised.png"); Frame PFrame(IFrame, false); #if defined(Convolution_) PFrame = Convolution3(IFrame, 1, 2, 1, 2, 4, 2, 1, 2, 1); #elif defined(EdgeDetect_) PFrame = EdgeDetect(IFrame, EdgeKernel::Laplace1); #elif defined(Gaussian_) Gaussian2D filter; PFrame = filter(IFrame); #elif defined(CUDA_Gaussian_) CUDA_Gaussian2D filter; PFrame = filter(IFrame); #elif defined(Bilateral_) Bilateral2D_Para para; para.sigmaS = 3.0; para.sigmaR = 0.02; para.algorithm = 0; Bilateral2D_Data bldata(IFrame, para); PFrame = Bilateral2D(IFrame, bldata); #elif defined(Transpose_) Transpose(PFrame, IFrame); #elif defined(CUDA_Transpose_) CUDA_Transpose(PFrame, IFrame); #elif defined(Specular_Highlight_Removal_) PFrame = Specular_Highlight_Removal(IFrame); #elif defined(Tone_Mapping_) PFrame = Adaptive_Global_Tone_Mapping(IFrame); #elif defined(Retinex_MSRCP_) PFrame = Retinex_MSRCP(IFrame); #elif defined(Retinex_MSRCR_) PFrame = Retinex_MSRCR(IFrame); #elif defined(Retinex_MSRCR_GIMP_) PFrame = Retinex_MSRCR_GIMP(IFrame); #elif defined(AWB_) AWB1 AWBObj(IFrame); PFrame = AWBObj.process(); #elif defined(NLMeans_) NLMeans filter; PFrame = filter(IFrame); #elif defined(BM3D_) BM3D filter; PFrame = filter(IFrame); #elif defined(Haze_Removal_) Haze_Removal_Retinex filter; PFrame = filter(IFrame); #elif defined(CUDA_Haze_Removal_) CUDA_Haze_Removal_Retinex filter; PFrame = filter(IFrame); #else PFrame = IFrame; #endif ImageWriter(PFrame, "D:\\Test Images\\BM3D\\_DSC8263.2bm3d.png"); system("pause"); return 0; }