示例#1
0
文件: DT.c 项目: CV-IP/lrw14
void ComputeDistanceTransform(double *in,double *out,int WIDTH,int HEIGHT) {
  
  EdgeDetect(in,out,WIDTH,HEIGHT);
  nNeighbor(out,1,1.351,WIDTH,HEIGHT);
  PutSign(in,out,WIDTH,HEIGHT);

}
示例#2
0
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;
}
示例#3
0
void RecallImage::CannyChanged(int value)
{
	CannyThreshold = value;
	EdgeDetect();
}
示例#4
0
int Test_Speed()
{
    const int Loop = 100;

    //Frame IFrame = ImageReader("D:\\Test Images\\Haze\\20150202_132636.jpg");
    Frame IFrame = ImageReader("D:\\Test Images\\BM3D\\_DSC8263.1noised.png");
    Frame PFrame(IFrame, false);
    const Plane &srcR = IFrame.R();
    Plane dstR(srcR, false);

    for (int l = 0; l < Loop; l++)
    {
#if defined(Convolution_)
        Convolution3V(IFrame, 1, 2, 1);
        //Convolution3(IFrame, 1, 2, 1, 2, 4, 2, 1, 2, 1);
#elif defined(EdgeDetect_)
        EdgeDetect(IFrame, EdgeKernel::Laplace2);
#elif defined(Gaussian_)
        Gaussian2D filter;
        filter(IFrame);
#elif defined(CUDA_Gaussian_)
        CUDA_Gaussian2D filter;
        filter(IFrame);
#elif defined(Bilateral_)
        Bilateral2D_Para para;
        para.sigmaS = 3.0;
        para.sigmaR = 0.08;
        para.algorithm = 1;
        Bilateral2D_Data bldata(IFrame, para);
        Bilateral2D(IFrame, bldata);
#elif defined(Transpose_)
        Transpose(PFrame, IFrame);
#elif defined(CUDA_Transpose_)
        CUDA_Transpose(PFrame, IFrame);
#elif defined(Specular_Highlight_Removal_)
        Specular_Highlight_Removal(IFrame);
#elif defined(Retinex_MSRCP_)
        Retinex_MSRCP filter;
        filter(IFrame);
#elif defined(Retinex_MSRCR_)
        Retinex_MSRCR filter;
        filter(IFrame);
#elif defined(Retinex_MSRCR_GIMP_)
        Retinex_MSRCR_GIMP filter;
        filter(IFrame);
#elif defined(Histogram_Equalization_)
        Histogram_Equalization(IFrame, 1.0, false);
#elif defined(NLMeans_)
        NLMeans filter;
        filter(IFrame);
#elif defined(BM3D_)
        BM3D filter;
        filter(IFrame);
#elif defined(Haze_Removal_)
        Haze_Removal_Retinex filter;
        filter(IFrame);
#elif defined(CUDA_Haze_Removal_)
        CUDA_Haze_Removal_Retinex filter;
        filter(IFrame);
#else
        const PCType pzero = 0;
        const PCType pcount = dstR.PixelCount();
        const PCType height = dstR.Height();
        const PCType width = dstR.Width();
        const PCType stride = dstR.Stride();
#endif
    }

    return 0;
}
示例#5
0
  bool AlignmentMarks::Process() {
  
    int maskwidth=10;

    int top,bottom;
    int x1,x2,x3,x4,y1,y2;
    
    top=FindTop();
    if(top==-1) return false;  
    
    bottom=FindBottom();
    if(bottom==-1) return false;
    
    if(printIntermediate){
      cout << "top=" << top<<" bottom="<< bottom << endl;
    }
    
    int *slice=GetVerticalSlice(0,Width(),maskwidth);
    EdgeDetect(slice,Height()+1,maskwidth,y1,y2);
    y2--;
    
    if(y1 <= y2){ top=y1;bottom=y2;}
    
    if(printIntermediate){
      cout << "y1=" << y1<<" y2="<< y2 << endl;
    }

    int limit=top + (int)(0.1*(bottom-top));
    int h=limit-top+1;
    
    slice=GetSlice(top,h,maskwidth);
    
    //if(Verbose()>1){
    //  cout << "Top slice:" << endl;
    //  for(int i=0;i<Width()+2*maskwidth;i++) cout <<i<<": " << (int)slice[i] << endl;
    //}
    
    
    EdgeDetect(slice,Width()+1,maskwidth,x1,x2);
    x2--;
    delete[] slice;
    
    limit=bottom-(int)(0.1*(bottom-top));
    h=bottom-limit+1;
    
    slice=GetSlice(limit,h,maskwidth);
    //if(Verbose()>1){
    //  cout << "Bottom slice:" << endl;
    //  for(int i=0;i<Width()+2*maskwidth;i++) cout <<i<<": " << (int)slice[i] << endl;
    //}
    EdgeDetect(slice,Width()+1,maskwidth,x3,x4);
    x4--;
    delete[] slice;
    
    if(printIntermediate){
      cout <<"x1=" << x1<<" x2="<< x2 << endl;
      cout << "x3=" << x3<<" x4="<< x4 << endl;
    }
    
    // scale the bottom alignment line
    
    double top_factor = 0.87;
    double center=(x3+x4)/2.0;
    double half_len = (x4-x3)*top_factor/2.0;
    x3 = (int)(center-half_len);
    x4 = (int)(center+half_len);
    
    if(printIntermediate){
      cout << "After scaling x3=" << x3<<" x4="<< x4 << endl;
    }
    
    // now write the result
    SegmentationResult result;  
    
    ostringstream *str=new ostringstream;
    (*str) << x1 << " " << top << " " << x2 << " " << top;
  
    result.name = "alignment_marks_top";
    result.type = "line";
    result.value = str->str();
    getImg()->writeFrameResultToXML(this,result);
    delete str;

    str=new ostringstream;
    (*str) << x3 << " " << bottom << " " << x4 << " " << bottom;
  
    result.name = "alignment_marks_bottom";
    result.value = str->str();
    getImg()->writeFrameResultToXML(this,result);
    delete str;
  
  return true;

}