ocl::dft behaves incorrectly (Bug #2614)


Added by KOLANICH KOLANICH about 12 years ago. Updated almost 10 years ago.


Status:Cancelled Start date:2012-12-09
Priority:Normal Due date:
Assignee:yao wang % Done:

0%

Category:ocl
Target version:-
Affected version:branch '2.4' (2.4-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description


void inline waitEsc(){
    const UINT max=90;
    UINT cnt;
    while (cvWaitKey(33)!= VK_ESCAPE);
}

string mainWindName="ocl::dft behaves incorrectly";

int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    std::vector<cv::ocl::Info> oclinfo;
    int devnums = cv::ocl::getDevice(oclinfo);
    if(devnums<1)
    {
        std::cout << "no device found\n";
        return -1;
    }

    Mat img;
    img=imread("image.jpg");
    namedWindow(mainWindName,CV_WINDOW_KEEPRATIO);
    Mat hsv;
    const UINT maxRegRow=10,maxRegCol=10;

    cvtColor(img,hsv,CV_BGR2HSV);
    ocl::oclMat hsvocl(hsv);
    ocl::oclMat hsvc[4];
    ocl::split(hsvocl,hsvc);

    int dfth=getOptimalDFTSize(hsvc[2].rows),dftw=getOptimalDFTSize(hsvc[2].cols);
    dftw+=dftw%2;
    dfth+=dfth%2;
    int brdrHor=(dfth-hsvc[2].rows)/2,brdrVer=(dftw-hsvc[2].cols)/2;
    brdrVer+=brdrVer%2;
    brdrHor+=brdrHor%2;

    ocl::oclMat vdft;
    ocl::copyMakeBorder(hsvc[2],vdft,brdrHor,brdrHor,brdrVer,brdrVer,BORDER_CONSTANT,cvScalarAll(0xff));
    imshow(mainWindName,Mat(vdft));
    waitEsc();
    vdft.convertTo(vdft,CV_32F);
    Mat zero=Mat::zeros(vdft.size(), CV_32F);
    ocl::oclMat fourierComponents[]={vdft,ocl::oclMat(zero)};
    ocl::merge(fourierComponents,2,vdft);
    ocl::dft(vdft,vdft);

    ocl::dft(vdft,vdft,cv::Size(0,0),DFT_INVERSE);

    ocl::split(vdft,fourierComponents);
    imshow(mainWindName,Mat(fourierComponents[0]));
    waitEsc();
    destroyAllWindows();
    return 0;
}

Associated revisions

Revision f4c5679d
Added by Andrey Pavlenko almost 11 years ago

Merge pull request #2614 from ilya-lavrenov:ipp_laplacian

History

Updated by Vadim Pisarevsky about 12 years ago

  • Category set to ocl
  • Assignee set to yao wang

Updated by Vadim Pisarevsky almost 10 years ago

OpenCL code in 2.4.x was experimental; in 3.0-dev it's less so, please, try it out; feel free to reopen the bug if the problem is still valid

  • Status changed from Open to Cancelled
  • HW Platform set to x64
  • Operating System set to Windows
  • Affected version set to branch '2.4' (2.4-dev)

Also available in: Atom PDF