I have a project, which I want to work with animation and opencv. The animation video will place on the screen with random rotation, scale and positon. And when the blob appear ( when viewers come before camera ), I want the videos inside the contour start to play, and the rest video will stay still with a black background until the blob move over them. Here is a layout of the idea.
I had do some searching in Internet, as I am quite new to programming, so Im actually still have a lot questions. Do I need to create a ofimage which have the videos on screen first? And then find the intersection of the screen image and the camera image? But as the first frames of all videos are black, how can I have the intersection image?
And is there another ways I can control the videos that show/start to play only when blob is over them?
Can anyone please provide me some information I can read and start?
Thanks a lot.
I think that you can do:
make a class extending ofVideoPlayer to create a player object
make another class to controll all the videoPlayers, get the contour finder and make a path with all the points, pass the path to the controller.
You want that the video plays when all the video area is in the contour or only a part, imagine that you get the center point of each videoPlayer as reference. You only have to check if point is in shape.
Hope that helps.
Thanks a lot for the help, I guess I understand what you meant, I am going to try it : ) Once I thought I can use the intersection part as a mask to active the videos, guess I’m wrong… And is that possible, that you can explain a bit more on how to pass the path to the controller? Thanks and sorry that I don’t really understand that part since I’m not so familiar to programming.
And actually the videos can start to play even just part of them are in the contour. Thanks : )
The path is a list of points, the points change on everyframe. Think as an array of all those points
With the points you make a shape, and in the controller you loop all your videos:
- and for every one checks if center is inside shape.
I can help you with the code if you post it, english is not my native language and there are things that i can not explain so well.
contour_points = yourblob.pts;
with the vector you make an ofPolyline
the polyline has a method to check if point is inside
bool ofPolyline::inside(const ofPoint &p, const ofPolyline &polyline)
whats your background language (as3, processing,…???)
Thanks again for your help : ) And I’m working on now what you suggested for the first part, create a class for all videos, thanks.
Actually I was an computer animator before, but have no programming background. And now I am an art student (new media) and have learnt some programming in web design, I had read informations and do some excises about Openframeworks, Processing and Arduino, And now I want to create a project with using openframeworks. So sorry that sometimes I used to the thinking of an animator, like using masks to control objects…
For your suggestions, I think I had read them in some examples before and happy to find and understand more with using them. And hope I can post my code soon, and I pretty sure I will have questions on them. And by the way, my native language is also not english, just hope my explaination is/ will be clear enough : )