Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: OpenCL: Image Processing Test [Updated Sep 04 2011]

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,907
    Blog Entries
    3
    Rep Power
    706

    OpenCL: Image Processing Test [Updated Sep 04 2011]

    I prepaired the first application with visual output in OpenCL, as I consider it more interesting than just watch numbers.

    It is basic image processing tester, you can freely edit the OpenCL program source, and the application will always expose all methods implemented.

    Unlike previous demos, this time the CL source is designed like DLL, composed of multiple procedures.
    Before using them, on application startup, the library will be compiled, and then you can directly execute the various kernels (methods of image processing).

    As usually, please let me know how did it work for you.

    On my PC with the sample image I get the result right after clicking the Process button, instantly. And this is in case where I use single "thread" for each pixel, which is the worst scenario.

    Important note: The code requires the OpenCL headers.


    Petr
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	OpenCL_ImageProcessing.jpg 
Views:	293 
Size:	81.8 KB 
ID:	7465  
    Attached Files Attached Files
    Last edited by Petr Schreiber; 04-09-2011 at 18:10.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  2. #2

    Re: OpenCL: Image Processing Test

    Hi Petr,

    This worked fine on my Nvidia GT100 system. It is good to see a range of OpenCL functions in action. My mental grasp of this parallel execution stuff is quite slow to develop. It is like learning to program all over again. New synapses need time to grow

    Charles

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,907
    Blog Entries
    3
    Rep Power
    706

    Re: OpenCL: Image Processing Test

    Thanks Charles,

    that is what I like most about the OpenCL, it is completely different programming from what I did till now. Very refreshing to think differently.

    Just the learning is currently like walking through a bush of roses, because you often realize tutorials on the net do not work the way they should.


    Petr


    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  4. #4
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    63
    Posts
    3,869
    Rep Power
    399

    Re: OpenCL: Image Processing Test

    Petr you are going to make me break my recent rule, after my last Windows install, to not put anything other than games on my gaming computer. Will get back to you later after I do the deed tonight
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    63
    Posts
    3,869
    Rep Power
    399

    Re: OpenCL: Image Processing Test

    Petr it ran great. I really like the 2line stripe. Now I don't need to look for a scanline plugin for photoshop. I like to use that effect for video transmissions from space, that is cool!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,907
    Blog Entries
    3
    Rep Power
    706

    Re: OpenCL: Image Processing Test

    Thanks Kent for the test!
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  7. #7
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    63
    Posts
    3,869
    Rep Power
    399

    Re: OpenCL: Image Processing Test

    Petr, I saw in the code opening up jpg. So I tried it and the first one it opened up fine, well it was upside down when it opened. The second one caused a crash. Do you have jpg importing started. or was it just pure luck that it worked on that one?
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,907
    Blog Entries
    3
    Rep Power
    706

    Re: OpenCL: Image Processing Test

    Hi Kent,

    I know, the TImage library sadly seems to be very unreliable, even for BMPs. This is why in the code I used Canvas methods in case of BMP file. We are investigating the issue.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  9. #9
    Member sblank's Avatar
    Join Date
    Feb 2010
    Location
    Wayne City, Illinois
    Posts
    80
    Rep Power
    18

    Re: OpenCL: Image Processing Test

    Hi Petr,

    All of your OpenCL programs work for me except for the image processing application. Here are the messages in the cmd screen when I try to run the program:

    OpenCL initialized...
    GPU Library is being compiled...
    Description: Failed to build program!:
    :86: error: no matching overload found for arguments of type 'double'
    float fR = convert_float(pixelIn[n].z) * sin(n/10.0);
    ^~~
    :87: error: no matching overload found for arguments of type 'double'
    float fG = convert_float(pixelIn[n].y) * sin((n+1)/10.0);
    ^~~
    :88: error: no matching overload found for arguments of type 'double'
    float fB = convert_float(pixelIn[n].x) * sin((n+2)/10.0);
    ^~~
    :104: error: no matching overload found for arguments of type 'double'
    float fR = convert_float(pixelIn[n].z) * sin((n+pixelIn[n].z)/20.0);
    ^~~
    :105: error: no matching overload found for arguments of type 'double'
    float fG = convert_float(pixelIn[n].y) * cos((n+1+pixelIn[n].y)/20.0);
    ^~~
    :106: error: no matching overload found for arguments of type 'double'
    float fB = convert_float(pixelIn[n].x) * sin((n+2+pixelIn[n].x)/20.0);
    ^~~

    OpenCL code: [!] Unknown error: 1
    Press any key to quit...

    The dialog box opens after this, but no image is present. I'm using the intact folder containing the bmp file, headers, and tbasic script file.

    My computer is a Quad-Core Sager 9262 laptop with 2 NVidia 9800M GTX video cards (1 gb each, 14 compute units and 112 cores each). I am using the 190.89 Beta driver, which works well with CUDA and the OpenCL programs from NVidia. I am running ThinBasic 1.7.10.2 Beta.

    Cheers,

    Stan

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,907
    Blog Entries
    3
    Rep Power
    706

    Re: OpenCL: Image Processing Test

    Hi Stan,

    your PC is power monster!

    The reason of problems could be that OpenCL has been introduced in NVIDIA drivers very recently. I experienced quite a few oddities with 190.89 myself too, and almost with each driver release after this, I had to mod the code little bit.

    This is the price for working with latest, borning technology.

    Do you think it would be possible for you to install ForceWare 196.21? I use them with 9500GT (lot weaker than yours, but the same family) without problem.


    Thank you,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

Page 1 of 2 12 LastLast

Similar Threads

  1. OpenCL: Vector Add [Updated Sep 04 2011]
    By Petr Schreiber in forum OpenCL
    Replies: 14
    Last Post: 09-02-2010, 10:33

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •