|
I´m new here, so I want to ask you guys if you could tell me how to (or point me in the right direction) composite my logo (with transparency) over live video. Kind of like what networks do when they place their logos over their signal. I am good at VB6, and am learning VB.NET. Should I do it in VC++?
Please help me, I am very interested in graphics programming.
jondiego
|
|
|
|
|
Check out Virtual Dub[^]
They have an overlay filter and might have the source code for it there.
Cheers,
Drew.
|
|
|
|
|
Drew, I really appreciate your response; I am new to this whole forum thing and thought noone would ever really read my post. Thanks again and when I try it I will tell you how im doing.
Juan Diego.
|
|
|
|
|
Lots of us read your post. Not lots of us know how to do it in VB.
OK, I can't say that - I meant I can't do it in VB
If you have access to each frame before it's rendered, you can draw the logo
on top of the frame bitmap then render it.
How is your video being rendered?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
jondiego wrote: I really appreciate your response;
No problem!
jondiego wrote: I am new to this whole forum thing and thought noone would ever really read my post.
Just be patient. There are lots of people here that want to help. It would probably help if you try yourself first so you can ask more specific questions.
This topic can be quite complicated, depending on the video stream you want to work with.
In essence, you need to retrieve decoded frames, overlay an image and then encode the stream again. The overlay part is very simple (check here on CP for lots of articles on how to do this using various languages). The decoding and encoding is done using a codec, of which many are available (some for pay, some from the public domain).
jondiego wrote: Thanks again and when I try it I will tell you how im doing.
Sounds great - it will be nice to hear how it works out for you.
Cheers,
Drew.
|
|
|
|
|
I forgot to mention that in the TV industry those logos are called "bugs".
Cheers,
Drew.
|
|
|
|
|
Trying to emulate the code presented in this article:
http://www.codeproject.com/vb/net/bitmapTxtr.asp
The method employed in the article is the following
1) Convert texture to grayscale by a method which results in the R, G, and B channels being identical.
2) Make the alpha channel the same as the other three channels as well. Then,
3) Scale the alpha channel by some percentage indicating desired degree of transparency ('float textureTransparency' in code from article)
4) Draw Texture to Bitmap.
The code I've written is not identical to that from the article but *should* be effectively the same. However, in my code if I leave out step 2 completely, it makes no difference - the visible results are exactly the same (meaning in my own application the results are the same - I didn't use bitmap from article). This is not what I would expect. I think the article writer said he was primarily a VB programmer, so he may not know what he's doing. (I'm not an expert in GDI+ either.) Should step 2 change the results or not? Can someone answer this definitively?
-- modified at 15:16 Friday 3rd August, 2007
|
|
|
|
|
Dear ATL C++ / graphics people,
I already searched the forums, but found no answer, just questions to
this topic. So I'll try my luck and post my question:
I am searching for an easy way to load a sequence of jpeg files (which
form a video) into memory and play them like a video. I furthermore
want to react on a keypress by drawing a frame into the current jpeg
in the sequence and saving it to disk/memory (maybe to disk not during
play, but after it, since there should not be delays, performance
does matter!). Is there a simple way to do this with the ATL already?
A little navigation functionality would be great (jumping to specific
frames, having a slider, Play/Stop Button etc.)
Did anyone already do something like that? I want to use pure ATL
and no MFC since I have a guideline to use ATL only.
Would be nice if that would be possible and anyone could help.
Best regards,
Peter.
|
|
|
|
|
hi
i need help about drawing shape and object with gdi+ and then select each object by mouse and can change some properties ?
thx
|
|
|
|
|
What part of the process do you need help with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how can i select a drawn object when mouse click on it?
for example i draw a circle and then a rectangel.
now i want to click on circle to select it and move it by mouse .
|
|
|
|
|
It's up to you to keep track of where you draw the objects.
With that saved info, you can perform "hit-testing", where you take the cursor position and
determine which drawn object the cursor is on.
To drag an object, the typical method is (in pseudocode):
On WM_LBUTTONDOWN
if mousecursor on an object (hit-test)
capture mouse (SetCapture())
save base cursor position
On WM_MOUSEMOVE
if mouse captured
if cursor position different than base cursor position
erase object at current its location
draw object at its new location (use delta from base cursor position)
set base cursor position to the current cursor position
On WM_LBUTTONUP
if mouse captured
release mouse capture (ReleaseCapture())
MArk
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
my problem excatly is how to hit testing ?
which class and command must use ?
thx
|
|
|
|
|
You need some way to decide if the cursor is on an object.
The simplest way is to use the bounding rectangle. The problem with this is hollow, overlapped objects.
You can use the PtInRect() API to test for a rectangle.
A little more complicated is to use regions.
You can use the PtInRegion() API to test for a rectangle.
You can make it as complicated as it needs to be.
There's lots of articles about hit testing. Here's one example: Win32: Hit Testing Lines and Curves[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: To drag an object, the typical method is (in pseudocode):
On WM_LBUTTONDOWN
if mousecursor on an object (hit-test)
capture mouse (SetCapture())
save base cursor position
On WM_MOUSEMOVE
if mouse captured
if cursor position different than base cursor position
erase object at current its location
draw object at its new location (use delta from base cursor position)
set base cursor position to the current cursor position
On WM_LBUTTONUP
if mouse captured
release mouse capture (ReleaseCapture())
You only need SetCapture() to detect the mouse outside the client area of the application.
You don't want to erase the entire object with each mouse move detection - only the part that's actually moved. If the mouse moves one pixel most of the object hasn't moved at all. If you erase the entire object each time there will be screen flashes.
Well, maybe that's what you meant by "use delta from base cursor position".
Nevermind.
|
|
|
|
|
|
here is another approach
the first thing you need to do is make a stack
which supports all the graphics you are using:
MyGraphicsStack;
MyGraphicsStack.add( line, rect, color, ... ); <- user draws a line
MyGraphicsStack.add( circle, rect, color, ..., fill ); <- user draws ..
.
.
(or better, make objects and inherit from the same base class)
Now when the user clicks, you create a white temporary bitmap
with the same dimensions as the user is drawing on.
the next thing is drawing your stack ( in the correct order )
on this temporary bitmap. For each item you are drawing,
ignore the color in the GraphicsStack but use instead:
(COLORREF)index_Of_Current_Object_In_MyStack.
(index casting to a color)
for filled objects: use this color for the fill/and the border color.
Then transform your mouse coordinates where the user clicked,
to bitmap coordinates. And for this coordination obtain the
bitmap pixel color.
When you cast the pixel color back it will be the index of the object
kept in your stack, ( or white in case user pressed the bitmap )
UINT nInd = (COLORREF)getpixel(..)
if ( nInd < MyGraphicsStack.Size( ) )
{
MyGraphicsStack[ nInd ] //<-- here it is
}
in this way you have always the topmost object even when
objects are drawn over each other. You also distinct
objects which are filled or not.
( depending on the bit depth of the bitmap you are creating
you are limited in the number of items you can draw,
in that case you could work with more bitmaps,
for a normal 24 bits bitmap you can keep 16777216 - 1 objects
1 = bitmap itself )
remark:
Because Gdi+ plus can ignore drawing objects you are drawing
outside the region of the dc, you can also create a small bitmap
(I think 16x16 is the minimum?) and when drawing to this bitmap
correct for the offset ( the bitmap coordinates the user selected )
in this way that the centre pixel of your small bitmap is the
pixel you are interested in.
well have fun!
|
|
|
|
|
hi... i would like to ask about the benefit of map file in VC++, map file can be created with building process of program.i have read one related to my program but i couldn't understand the information it contains.
what is the benefit of this file?
and in what we can use its information?
Regards
maria
|
|
|
|
|
A linker optionally generates a map file, typically listing all the modules that
were used to generate the output file (DLL, EXE, whatever), the global symbols
that got resolved, and their addresses and sizes in memory.
This can be helpful when you need to debug either the build process itself
or the application.
With Visual Studio the build process is quite reliable.
With Visual Studio you typically get symbolic information through the PDB file.
And with .NET languages, you typically get adequate Exception information.
As a result, map files are not needed much nowadays for desktop SW development.
|
|
|
|
|
thank U Luc Pattyn for UR information about my question..
now and by UR nice information i became know what is the map file..
thanx a lot
maria
|
|
|
|
|
Hi Maria,
you're welcome.
I forgot one, rather obvious, aspect: on most linkers, the map file is a
text file, that you can open using a text editor...
|
|
|
|
|
Thank U again Luc Pattyn ... yes i have openned one of these files (map files) using text editor..
maria
|
|
|
|
|
Hi,
This is Jats,
I have a neccesity of adding water mark to a video file.
Do any one have an idea of it.
Need help....
Thank You....
Jats
|
|
|
|
|
You have to specify the type of video file ur using , if it is uncompressed AVI , simply you can decode the avi and grab each frame , add ur water mark image or text to that.
If ur video file is mpeg or wm files, better to write this part as a filter. Also you should have the corresponding decoderes and encoderes, for example mpegvideo - >decode -> raw video-> ur filter -> again encode -> write to file
If u can Dream... U can do it
|
|
|
|
|
heyhey
i know I'm just someone asking for the millionth time... but I read a lot about cameras and even read the Games Germs article in my book, but I cannot get the vector camera running...
here are my questions:
*I know I've got UVN vectors (for right, up, and forward) (?)
*I need an additional vector for the viewing direction, right?
*the viewing direction is calculated by the angles yaw, pitch and roll around the right, up and forward vectors, right?
*are the vectors right, up and forward fix? I mean are they always parallel to the plane I'm walking on when I want to do a first-person camera?
*when I want to use the gluLookat function do I put in the lookat-vector as vector of length 1 or is it: pos+fwd?
hm... those things troubled me for some time now
PS: a general question: when I wanna keep my "gameengine" as usable as possible is it better to put the camera as seperate Object-Class on which the Game-Class has access or should I put it to the player-class?
both have their advantages... either seperate camera which can be switched for animation scenes... or easy-access when player-data is needed?
dyou know what i mean?
thx in advance
|
|
|
|