Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2016-03-26 04:44:28 -0600

Nbb gravatar image

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg.

1) the flip operation does not get called. 2) it sometimes lag

Mat frame

omp_set_num_threads(3);
#pragma omp parallel shared(frame)
{
    int TID = omp_get_thread_num();

    while(true)
    {

        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        #pragma omp single
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
        } 
    }
}

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg.

1) eg the flip operation does not get called. 2) it sometimes lag

Mat frame

omp_set_num_threads(3);
#pragma omp parallel shared(frame)
{
    int TID = omp_get_thread_num();

    while(true)
    {

        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        #pragma omp single
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
        } 
    }
}

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg the flip operation does not get called.

Mat frame

omp_set_num_threads(3);
#pragma omp parallel shared(frame)
parallel
{
    int TID = omp_get_thread_num();

    while(true)
    {
         Mat frame
        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        #pragma omp single
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
        } 
    }
}

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg the flip operation does not get called.

omp_set_num_threads(3);
#pragma omp parallel
{
    int TID = omp_get_thread_num();

    while(true)
    {
        Mat frame
        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        if(TID == 0) // #pragma omp single
single causes program to hang
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
        } 
    }
}

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg the flip operation does not get called.

Mat frame
omp_set_num_threads(3);
#pragma omp parallel
{
    int TID = omp_get_thread_num();

    while(true)
    {
        Mat frame
        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        if(TID == 0) // #pragma omp single causes program to hang
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
        } 
    }
}

Question regarding OpenMP + OpenCV (frame processing)

Hello

I was hoping someone with knowledge in OpenMP would be able to assist me. I am trying to read in a frame using a single thread then have 3 separate threads doing different operations on the frame. I would then merge and display the results on a single frame. The problem is that I am getting weird results for eg the flip operation does not get called.

Mat frame
omp_set_num_threads(3);
#pragma omp parallel
{
    int TID = omp_get_thread_num();

    while(true)
    {
        vector<Object> objects;
        #pragma omp single
        {
              // read in frame
              flip(frame, frame, 1);
        } 

        if(TID == 0)
        {
            // process frame
            // Store result in vector<Object>
        }

        else
        {
            // process frame with a different operation
            // Store result in vector<Object>
        }

        #pragma omp barrier
        if(TID == 0) // #pragma omp single causes program to hang
        {
              // merge results
              // do some drawing on frame based on results
              imshow(frame);
              waitKey(1);
        } 
    }
}