Video Capture from Camera Input Interface on Colibri Board

Respected Sir,
I have done connections for camera input interface following this site:

Only instead of Camera at end, I have connected a DVD player.
There is a video in CD inserted in DVD player. I want to read the video from CD which is in DVD player. Now, I have created a OpenCV (Version - 5.3.1) program for accessing the video from DVD player in which I have written

VideoCapture cap(0)

Is this correct?

After cross-compiling the program to output, and running it on board with ./output, I get following error:
***OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /usr/src/debug/opencv/3.3+gitAUTOINC+87c21
VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast

/usr/src/debug/opencv/3.3+gitAUTOINC+87c27a074d_2a9d1b22ed_a62e20676a_34e4206aee
in function cvCaptureFromCAM_GStreamer***

Program in OpenCV (3.5.2)

using namespace std;
using namespace cv;

int main()
{

   VideoCapture cap(0);

    int size = 2;
    bool drawCross = 1;
    int x = 320;
    int y = 240;
    int z = 0;
    int thick = 1; 

    while(true)
    {
      Mat frame;    
      // Capture frame-by-frame
      cap >> frame;
      // If the frame is empty, break immediately
      if (frame.empty())
        break;

       // for converting the frame to grayscale  
       Mat gray;

       cvtColor( frame, gray , COLOR_BGR2GRAY);
       if (drawCross)
       {
          line( frame, Point( x- 10*size-z, y ), Point( x + 10*size + z, y), Scalar( 0, 0, 255 ),  thick, 4 );
          line( frame, Point( x, y-10*size + z), Point( x, y + 10*size + z), Scalar( 0, 0, 255 ), thick, 4);
       }

       imshow(" figure ",frame);
       char c=(char)waitKey(25);
       char m=(char)waitKey(25);
       char n=(char)waitKey(25);
   }

   cap.release();
   destroyAllWindows();
   return 0;
 }

Thank you for help.

What exact hardware (module and carrier board) and software versions of things are you talking about? I assume you already got the camera initially working according to our article you linked to above, right?

@marcel.tx sir, we did not take camera as input. We took dvd player as input. I am using Colibri Evaluation board, CVBS input for DVD player and card - Analogue Camera Module V 1.1A

Sure, camera or DVD player doesn’t matter. But did you do the basic bring-up thereof according to the article in question? Plus we are still missing any information concerning the exact hardware (module and carrier board) and software versions of things are you talking about.

@marcel.tx sir, yes sir. I got the basic bring up according to article.

Board: Colibri Evaluation Board

Hardware Modeule: Col imx6DL 512MB IT - V 1.0A

Software Versions: OpenCV C++ 3.5.2 and Linux OS

@marcel.tx sir, is anything more information needed concerning hardware (module and carrier board)?

hi @tanvi: What is the version of your Bsp ( uname -a )?
How did you install opencv on the module?

@jaski.tx sir,

version of bsp using uname -a: linux colibri-imx6 4.9.166-2.8.6+gd899927728be #1 SMP Mon Apr 1 00.51.01 UTC 2019 armv71 GNU/Linux

Taking reference of this link High performance, low power Embedded Computing Systems | Toradex Developer Center, I completed it till sdk installation.

Preparing for cross-compilation

After you install the SDK, there will be a sysroot for the target (Arm) inside the SDK directory. I Created an OpenCV directory inside

Then i installed Cmake:
sudo apt-get install cmake

mkdir OpenCV

gedit CMakeLists.txt


cmake_minimum_required(VERSION 2.8)

project( MyProject )

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
“${CMAKE_BINARY_DIR}/bin”)

add_executable( myApp src/myApp.cpp )

SET(CMAKE_PREFIX_PATH /usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi)

SET(OpenCV_DIR ${CMAKE_PREFIX_PATH}/usr/lib/cmake/OpenCV)

find_package( OpenCV REQUIRED )

include_directories( ${OPENCV_INCLUDE_DIRS} )

target_link_libraries( myApp ${OPENCV_LIBRARIES} )

It is also needed to have a CMake file to point where are the includes and libraries.

cd /usr/local/oecore-opencv2_4/sysroots/armv7at2hf-vfp-neon-angstrom-linux-gnueabi/usr/lib/cmake

mkdir OpenCV

gedit OpenCV/OpenCVConfig.cmake


set(OPENCV_FOUND TRUE)

get_filename_component(_opencv_rootdir

${CMAKE_CURRENT_LIST_DIR}/…/…/…/ ABSOLUTE)

set(OPENCV_VERSION_MAJOR 3)

set(OPENCV_VERSION_MINOR 1)

set(OPENCV_VERSION 3.3)

set(OPENCV_VERSION_STRING “3.3”)

set(OPENCV_INCLUDE_DIR ${_opencv_rootdir}/include)

set(OPENCV_LIBRARY_DIR ${_opencv_rootdir}/lib)

set(OPENCV_LIBRARY -L${OPENCV_LIBRARY_DIR} -lopencv_aruco -lopencv_bgsegm
-lopencv_bioinspired -lopencv_calib3d -lopencv_ccalib -lopencv_core
-lopencv_datasets -lopencv_dnn -lopencv_dpm -lopencv_face -lopencv_features2d
-lopencv_flann -lopencv_fuzzy -lopencv_highgui -lopencv_imgcodecs
-lopencv_imgproc -lopencv_line_descriptor -lopencv_ml -lopencv_objdetect
-lopencv_optflow -lopencv_photo -lopencv_plot -lopencv_reg -lopencv_rgbd
-lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_stitching
-lopencv_structured_light -lopencv_superres -lopencv_surface_matching
-lopencv_text -lopencv_tracking -lopencv_videoio -lopencv_video
-lopencv_videostab -lopencv_xfeatures2d -lopencv_ximgproc -lopencv_xobjdetect
-lopencv_xphoto)

if(OPENCV_FOUND)

set( OPENCV_LIBRARIES ${OPENCV_LIBRARY} )

set( OPENCV_INCLUDE_DIRS ${OPENCV_INCLUDE_DIR} )

endif()

mark_as_advanced(OPENCV_INCLUDE_DIRS OPENCV_LIBRARIES)

After that, return to the project folder. You must export the SDK variables and run the CMake script

$ source /usr/local/oecore-x86_64/environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi

$ cmake .

I followed above steps sir.

@jaski.tx sir, is anything more information needed of cv installation sir?

hi @tanvi

I will check for this issue and come back soon to you.

Best regards,
Jaski

@jaski.tx sir, Okay sir. Thank you for help.

@jaski.tx sir, hello sir. I am still stuck to this problem mentioned. Can something be tried sir?

@jaski.tx sir, what can be solution for below error:
***OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /usr/src/debug/opencv/3.3+gitAUTOINC+87c21 VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast

/usr/src/debug/opencv/3.3+gitAUTOINC+87c27a074d_2a9d1b22ed_a62e20676a_34e4206aee in function cvCaptureFromCAM_GStreamer***

Thank you for help.

@jaski.tx sir, does any driver needs to be enabled to access dvd player?

How do you access the DVD Player from the module?
Which interface are you using for the connection?

@jaski.tx sir, I am using X1 interface on Colibri Evaluation board. I am connecting the analogue camera module using 24-pin FRC cable. Then to one of the decoder pins, I am connecting RCA cable to connect with dvd player.

Could you share pictures of your connection? Thanks.

link text

@jaski.tx sir, please find the pictures of connections. Thank you.

@jaski.tx sir, any solution?

@tanvi : On a Colibri iMX6 the device tree imx6dl-colibri-cam-eval-v3.dtb must be loaded in U-Boot to set the non standard pin muxing and configuration needed
On U-Boot try changing env setings
Colibri iMX6 # setenv fdt_file imx6dl-colibri-cam-eval-v3.dtb
Colibri iMX6 # saveenv
Source How to use Analogue Camera Adapter on Embedded Linux
once u successfully complete it you can see the index of video/camera so called VideoCapture cap(0);
in terminal of toradex type ls -itrh /dev/video*… you can see many videoX, X= int number depending on machines OS. eg. video0 for → VideoCapture cap(0)