5

This is my first time posting here and hoping for a positive result since my research is near its conclusion.

I want to add in my code a function that will process only the defined region of interest of a video file.

(I can't post image since I don't have yet a reputation but same question is posted here ---> http://answers.opencv.org/question/18619/region-of-interest-in-video-file/)

Storyboard:

I'm making a program in C++/OpenCV that will make the pedestrians and vehicles look that they are not in the scene/disappear by getting the running average of the videos frame. I already made that. Now my problem is I do want only the portion of the video that is under the region of interest to be processed because I want to preserve the Lighting/Illumination of the Christmas lights while they are blinking.

Why? I want to use this method to capture only the blinking lights this coming yuletide season without the disturbance of vehicle and people in the scene.

How can I do that? I mean getting a region of interest in a video file.

Thanks in advance.

eddie
  • 1,252
  • 3
  • 15
  • 20
mabg
  • 73
  • 4

1 Answers1

3
  1. Fix your ROI Position.
  2. Take the region from each frame of the video.
  3. Then process it.
  4. Apply for all frames.

Like this:

cv::Rect ROI(startX,startY,width,height);
while(1)
{ 
   cap.read(frame);
   temp = frame(ROI);
   process(temp);
}
Barshan Das
  • 3,677
  • 4
  • 32
  • 46
  • Thanks @Barshan Das, BTW, what should be the value of my x,y, width, height Say my video frame is 640x360 then as the picture suggest, my desired region of interest is around 640x100.Also, what do you mean by take the region from each frame of the video? – mabg Aug 12 '13 at 08:17
  • startX and startY values are the co-ordinate value of top left pixel of your region of interest. width and height are the width and height of your region of interest. In your case probably it will be: cv::Rect ROI(0,0,640,100); region from each frame of the video means: take 1st frame from video. get the image portion under your region of interest. next take 2nd frame from video and do the same. and so on for all frames. – Barshan Das Aug 13 '13 at 11:24