This is a theory question!
My objective is to add annotations to a video frame.
Say, I take a video frame, and want to add text to it.
My decoded frame is in YUY2 space. This is what I am thinking I should do.
1. Convert YUY2 frame to RGB32.
2. The "text image" which is in RGB32 will now be overlaid/composited on the RGB32 video frame.
3. Convert the composited image to YUY2 and send it to encoder.
Is my approach correct? What are the best IPP functions to accomplish compositing. I already know how to convert between color spaces.
Link Copied
Hi Sergey;
I could not find that function at all. I searched the IPP "Image and Video Processing Manual" for IPP 7.1. I did a general google search. I even searched from the search facility in this forum.
I searched for "ippiDrawText" as well as "ippiDrawText_8u". I could not find any results!
I am not sure, but may be ippiAdd_*. will help you to compose both of these images.
>>"You're right and the function was deleted in some version of IPP, maybe in v5 or in v6. What I see that it exists in older versions of IPP.
>>So, do you want to preseve a background of a source image?"
Hi Sergey;
Yes. The way it could be implemented is that the background image would be "as is". I would paste this "text image" or "speech bubble" or anything on top of it. In this operation, the part of the background image where there is no "speech bubble" not "text" would be as is. Otherwise, the "text" or "speech bubble" would show up on top.
I hope I made sense!
Hi Sergey;
Many thanks!
Yes, the second image will just have speech bubble with empty background (all zeros). It will be already created. At least for my first cut, I am not worried about how such image will be generated.
Now, I can start my project. I will post updates on my progress here!
Thanks Sergey;
In this your "empty pixels" were white, right? and the image to be shown was black (black dots)?
I have started coding with black as empty with the "Or" operation and will report back.
ps: This is also like image layering operation in GIMP, right?
Hi Sergey;
I am trying to do the same in ImageJ. I can OR an image with a constant. How did you OR these two images? (or whatever operation it is that you did?)
Which brings an interesting question.
What if my Text is in black and the rest of the "empty" pixels is white? In this case, some sort of AND operation?
Awesome Sergey!
I was able to composite with OR operation when the background was black and with AND operation when the background was white.
I will certainly look at directdraw interfaces as well.
I will report back progress as I work on this project.
Awesome Sergey!
I was able to composite with OR operation when the background was black and with AND operation when the background was white.
I will certainly look at directdraw interfaces as well.
I will report back progress as I work on this project.
Really appreciate all the help Sergey.
Hi Sergey;
An update.
I am targeting Windows 7 only and am also looking into Direct2D. I am wary of using directshow as it is being deprecated. I will let you know if I find something similar in Direct2D.
Interestingly Direc2D on Windows 8 offers custom effects as well as easy blending. But not on Win 7.
Hi Sergey;
More progress.
I updated windows 7 with "Windows 7 platform update" and now I have all the functionality Direct2D functionality including blending and builtin effects.
I will report back on the API the I will use and progress.
For more complete information about compiler optimizations, see our Optimization Notice.