Ask Your Question

Vijay Kakani's profile - activity

2018-02-09 18:04:16 -0600 received badge  Notable Question (source)
2016-12-18 16:00:01 -0600 received badge  Popular Question (source)
2016-11-23 11:39:13 -0600 received badge  Notable Question (source)
2015-06-03 12:32:47 -0600 received badge  Popular Question (source)
2013-07-06 08:55:21 -0600 asked a question **Saving a Video Output (.mov) on disk**

Hi Everyone,

These days I'm getting familiar to Open CV, thanks for your support.

Q: How to save the "Output Video" (.mov)in the following program to my disk? I've seen many answer on web but unable to customize them according to my program. Please suggest a code fragment that suits this program.

int main()

 { 

cv::VideoCapture capture("F:/Bee videos/P1040356.mov");

if (!capture.isOpened())

            {
        std::cerr << "Unable to load the video" << std::endl;
        return 1;
    }

// Get the frame rate
double rate= capture.get(CV_CAP_PROP_FPS);

bool stop(false);
cv::Mat frame; // current video frame
cv::namedWindow("Extracted Frame");

// Delay between each frame
// corresponds to video frame rate
int delay= 1000/rate;

// for all frames in video
while (!stop) {

    // read next frame if any
    if (!capture.read(frame))
        break;

    cv::imshow("Extracted Frame",frame);

    // introduce a delay
    // or press key to stop
    if (cv::waitKey(delay)>=0)
            stop= true;
}

// Close the video file
capture.release();

cv::waitKey();

// Now using the VideoProcessor class

   // Create instance
VideoProcessor processor;
// Open video file
processor.setInput("F:/Bee videos/P1040356.mov");
// Declare a window to display the video
processor.displayInput("Input Video");
processor.displayOutput("Output Video");  
// Play the video at the original frame rate
processor.setDelay(1000./processor.getFrameRate());
// Set the frame processor callback function
processor.setFrameProcessor(canny);
// Start the process
processor.run();
cv::waitKey();

Thanks in anticipation,

Kindest Regards,

Vijay Kakani

2013-06-26 08:13:58 -0600 commented answer Problem in opening the video files using Open CV

Thanks a million Mathieu, It is working perfectly now. I added a log message above and changed the backslash... I'm new to Open CV, some of my questions seems little silly but thanks for answering with patience.

Kindest Regards, Vijay Kakani

2013-06-25 20:52:26 -0600 asked a question Problem in opening the video files using Open CV

Hi Everyone,

I'm unable to open the video files using this code... Please do have a look at it, I tried on various video clips like .avi, .mov etc...

Here is the code:

#include "F:\opencv243\include\opencv2\opencv.hpp"
#include "F:\opencv243\include\opencv\stdafx.h"
#include "F:\opencv243\build\include\opencv2\core\core.hpp"
#include "F:\opencv243\build\include\opencv2\imgproc\imgproc.hpp"
#include "F:\opencv243\build\include\opencv2\highgui\highgui.hpp"
#include "iostream"
#include "vector"
#include "stdio.h"

int main()
{
    // Open the video file
    cv::VideoCapture capture("F:\Bee videos\P1040356.mov");
    // check if video successfully opened
    if (!capture.isOpened())
            return 1;

    // Get the frame rate
    double rate= capture.get(CV_CAP_PROP_FPS);

    bool stop(false);
    cv::Mat frame; // current video frame
    cv::namedWindow("Extracted Frame");

    // Delay between each frame
    // corresponds to video frame rate
    int delay= 1000/rate;

    // for all frames in video
    while (!stop) {

        // read next frame if any
        if (!capture.read(frame))
            break;

        cv::imshow("Extracted Frame",frame);

        // introduce a delay
        // or press key to stop
        if (cv::waitKey(delay)>=0)
            stop= true;
    }

    // Close the video file
    capture.release();
}

Code is ok with build but for debugging, if shows the following:

'Video frames try.exe': Loaded 'F:\opencv243\Projects\Video frames try\Debug\Video frames try.exe', Symbols loaded.

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'F:\opencv243\build\x86\vc10\bin\opencv_core243d.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.

'Video frames try.exe': Loaded 'F:\opencv243\build\x86\vc10\bin\opencv_highgui243d.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file

'Video frames try.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file

'Video ... (more)

2013-06-21 11:04:04 -0600 asked a question Reading (quick time movie:- .mov) clip as input in Open CV

Hi Open CV group,

Firstly, thanks for your support till date. As I am new to Open CV, I've gone through some sample tutorials and made a code fragment for background separation.

include "stdafx.h"

include "opencv2/opencv.hpp"

include "iostream"

include "vector"

int main(int argc, char *argv[])

{

cv::Mat frame;
cv::Mat back;
cv::Mat fore;
cv::VideoCapture cap(0);
cv::BackgroundSubtractorMOG2 bg(10000, 25, false);
std::vector<std::vector<cv::Point> > contours;
cv::namedWindow("Frame");
cv::namedWindow("Background");
for(;;)
{
    cap >> frame;
    bg.operator ()(frame,fore);
    bg.getBackgroundImage(back);
    cv::erode(fore,fore,cv::Mat());
    cv::imshow("Frame",fore);
    cv::imshow("Background",back);
    if(cv::waitKey(30) >= 0) break;
}
return 0;

}

I am able to separate the background using camera as input.

How to use the (quick time movie, i.e; .mov video clip) as input to the above program??

2013-06-21 11:02:31 -0600 commented question ***Background separation of video stream by using static background image***

Hi Victor1234, Firstly, thanks for your prompt response. I have a jpeg picture (one static frame of video clip), can I use that static picture to separate the background in the whole video clip (quick time movie {.mov} )??? Sorry for not conveying the question properly

2013-06-21 10:57:05 -0600 commented answer ***Background separation of video stream by using static background image***

Thank you very much Mr. Mathieu Barnachon; I am working according to your suggestions I'm new to Open CV. Thanks a million for your valuable information. I have a small question, If possible please suggest me with the solution. I am posting it as a new question

2013-06-21 10:32:48 -0600 received badge  Scholar (source)
2013-06-21 10:32:45 -0600 received badge  Supporter (source)
2013-06-12 11:33:16 -0600 asked a question ***Background separation of video stream by using static background image***

Hi Everyone,

I'm new to Open CV and present working on my project which needs background separation done with OpenCV.

Two days back I configured Open CV with Visual Studio C++ 2010 and worked on small tutorials from this blog http://opencv-srf.blogspot.ie/

By I am not sure about how to make the BGS from a video file and background image I am having on my disk...

Can anyone please suggest me with some code that could help me in extracting the background from video (type: quick time movie)by using static background image (jpeg).

Thanks in anticipation

Kindest Regards,

Vijay Kakani