0

I am developing a project in Android to Draw/Overlay/Paint flag or other image on Face. Or Draw/Overlay/Paint an Image with another image i.e. embed image into other. Take a close look below.

enter image description here enter image description here

I am using the Face Detection Vision Api of Google, and get the Landmarks and even whole face and draw a simple rectangle around using An Introduction to Face Detection on Android

But the Question is:

- How to draw image on another image as shown above?

- Am I on the right path i.e. Face Detection and then draw something?

Please give me some sample code that how to start with or give me some github libs if available. Thanks.

Zia Ur Rahman
  • 1,850
  • 1
  • 21
  • 30
  • Is it possible to derive your own class view from FaceOverlayView and override its paint function.You can use canvas object in paint function to put any image over what already has been painted. – R1349 Aug 14 '17 at 10:20
  • @R1349, I am working on, today and even will share the code ... and then will be back to you when do my efforts. Meantime, if you can provide some nice example of exact what I want ... so please do and Rest I m doing my own, hope will get to the point. Insha Allah. – Zia Ur Rahman Aug 14 '17 at 12:13
  • I don't have sample code for FaceOverlayView unfortunately.but I have done such a work with OSM map view.All these classes have been derived from View class and their paint function can be overriden. – R1349 Aug 16 '17 at 05:28
  • @R1349, what type of work you have done before, can you please share some screenshots, and can you please give me the link where your app is Up. so that I will check it entirely, and if your work meet my task and requirements then we will discuss it further and even will get some code. Insha Allah. – Zia Ur Rahman Aug 16 '17 at 08:22
  • I have override Draw method in my View class and put some text,draw some vectors and put some images on the view drawing by using canvas object that was passed in the override method.All these stuffs are drawn over the main image of view(drawn by view itself). – R1349 Aug 17 '17 at 05:58
  • public override void Draw (Canvas canvas) { float radius = 100; string str = "Logo"; Path p = new Path (); p.AddCircle (50,50, radius,Path.Direction.Cw); Paint pnText = new Paint (); pnText.Flags = PaintFlags.AntiAlias; Rect textRect = new Rect (); pnText.GetTextBounds (str, 0, str.Length, textRect); pnText.TextSize *= (float)(Math.PI * 2 * radius) *1.1F; pnText.TextSize /= textRect.Width (); pnText.TextSize/=1.12F; pnText.Alpha = 30; pnText.SetStyle (Paint.Style.Stroke); canvas.DrawTextOnPath (str, p, 0, 0, pnText); } – R1349 Aug 17 '17 at 06:04
  • This is a snippet code I wrote in Xamarin Mono C# to paint the logo name on the back ground of tablet screen.I could not insert it in the right manner in this comment editor.Sure you can use it directly but may give you an idea and you can probably do something like this with your own view derived class. – R1349 Aug 17 '17 at 06:10
  • @ZiaUrRahman do u have find the sloution for it? – Umar Ghaffar Jan 08 '20 at 09:17

0 Answers0