how to use the ocl in opencv with imx6q?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use the ocl in opencv with imx6q?

2,834 Views
wangziyou
Contributor I

i had compiled opencv 2.4.5 successfully,but it run failured as following:

root@myzr /opt/opencvtest$ ./hog pic1.png

Controls:

        ESC - exit

        m - change mode GPU <-> CPU

        g - convert image to gray or not

        1/q - increase/decrease HOG scale

        2/w - increase/decrease levels count

        3/e - increase/decrease HOG group threshold

        4/r - increase/decrease hit threshold

Scale: 1.05

Group threshold: 8

Levels number: 13

Win width: 48

Win stride: (8, 8)

Hit threshold: 1.4

Gamma correction: 1

OpenCV Error: Gpu API call (CL_INVALID_DEVICE_TYPE) in getDevice, file /mnt/share/opencv-2.4.5/modules/ocl/src/initialization.cpp, line 312

error: /mnt/share/opencv-2.4.5/modules/ocl/src/initialization.cpp:312: error: (-217) CL_INVALID_DEVICE_TYPE in function getDevice

Segmentation fault

ocl/src/initialization.cpp lines 313 is:

309:               cl_uint numsdev;

310:               cl_int status = clGetDeviceIDs(platforms[i], devicetype, 0, NULL, &numsdev);

311:               if(status != CL_DEVICE_NOT_FOUND)

312:                   openCLVerifyCall(status);

it means that the initialization is failure,so i searched in internet,and find and  document <<Fast Image Processing with i.MX 6 Series>>(http://cache.freescale.com/files/32bit/doc/app_note/AN4629.pdf ) and a link (Freescale OpenEmbedded/Yocto Layers discussion list ()​ ,but the new problem is:

(1)the pdf document  Implemented the face detector,Object detection,Image processing ,but where can i download the code?

(2) the link tell that :

"You are right, the OCL module in OpenCV is CUDA based, it doesn´t work for us. Using OpenCL in this case, you can base on OpenCL embedded profile tutorials you can find in the web also, I created a simple OCL SDK, that provides you a quick start for opencl application, unfortunately it is not available outside Freescale yet, there are some samples there (IP filtering) that you could use, I just need to check if I can share right now",

who can tell me: is it right that "the OCL module in OpenCV is CUDA based, it doesn´t work for imx6"?  the author created a simple OCL SDK ,but where is it,can i use it?

can you answer me as soon as possible? it is hurry!!

0 Kudos
8 Replies

1,483 Views
xuelongyin
Contributor I

hello,I want to know that do you use the ocl in opencv with imx6q successfully?

what is your solution? thanks。

0 Kudos

1,483 Views
andre_silva
NXP Employee
NXP Employee

Hi Xuelong,

OCL in OCV is not supported on imx6q (embedded profile), only on imx6qp.

cheers,

andre

0 Kudos

1,483 Views
xuelongyin
Contributor I

Hello,I am a graduate student, I download your code about opencl from GitHub - andreluizeng/opencl: i.MX OpenCL + OpenCV sample codes。I make it success,but when I run ./cl_helloworld on my board(imx6q, Linux 3.0.35),There are some questions: sometimes it run success;sometimes it run error,the one kind of error messages as following:
Initializing OpenCL: Ok
-=-=-=- Platform Information -=-=-=-
Platform Name: Vivante OpenCL Platform
Platform Profile: EMBEDDED_PROFILE
Platform Version: OpenCL 1.1
Platform Vendor: Vivante Corporation
-=-=-=- Device Information -=-=-=-
Device Name: Vivante OpenCL Device
Device Profile: EMBEDDED_PROFILE
Device Version: OpenCL 1.1
Device Vendor: Vivante Corporation
Device Max Work Item Dimensions: 3-D
Device Max Work Group Size: 1024
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Loading CL programs: hello_world Ok
Building hello_world kernel:
*** glibc detected *** ./cl_helloworld: malloc(): memory corruption: 0x00022768 ***
Aborted

another kind of error messages as following:
Initializing OpenCL: Ok
-=-=-=- Platform Information -=-=-=-
Platform Name: Vivante OpenCL Platform
Platform Profile: EMBEDDED_PROFILE
Platform Version: OpenCL 1.1
Platform Vendor: Vivante Corporation
-=-=-=- Device Information -=-=-=-
Device Name: Vivante OpenCL Device
Device Profile: EMBEDDED_PROFILE
Device Version: OpenCL 1.1
Device Vendor: Vivante Corporation
Device Max Work Item Dimensions: 3-D
Device Max Work Group Size: 1024
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Loading CL programs: hello_world Ok
Building hello_world kernel:
cl_helloworld: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.
Aborted

I think the program stopped at Line 610(cl_helloworld.cpp) “ error = clBuildProgram ((* program), 1, device_id, "", NULL, NULL);”,but I cannot solve it. I hope I can get your help. Thank you!

0 Kudos

1,483 Views
andre_silva
NXP Employee
NXP Employee

Are you using a NXP or a custom board ? I have been working a much newer kernel and GPU driver (which is the recomendation) is it possible to do some tests a 4.1.15 kernel ?

regards,

Andre

0 Kudos

1,483 Views
art
NXP Employee
NXP Employee

Please refer to attached document for the detailed information on the graphics features, supported by the i.MX6 platform.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,483 Views
wangziyou
Contributor I

I downloaded this file and simply looked at it, and didn't find what I needed.

I need the  sourcecode of object detection and face recognition  or gesture recognition demo in the <<Fast Image Processing with i.MX 6 Series>> ,or the OCL sdk which can replace the ocl module in opencv.

thanks.

0 Kudos

1,483 Views
art
NXP Employee
NXP Employee

There is no source code available. The AN4629 just describes the basic principles, all other work is up to you.

Artur

0 Kudos

1,483 Views
wangziyou
Contributor I

oh, the screenshots in AN4629 are artificial

0 Kudos