In the below image red color is the canvas. The black color part is the figure I am drawing in my canvas. I want to crop the black color part from my canvas. How shall I do it?.
I tried using canvas.clipPath() but I guess its no longer supported in Android now, due to hardware acceleration. I tried disableing the hardware acceleration also but it dint work so I gave up on canvas.clipPath().
Is there any other way I can use to crop path within canvas?
Any help will be appreciated. Thanks in advance :)
Related
I have worked on face detection and use http://www.milbo.users.sonic.net/stasm/ for landmark detection.
I have detected all face landmarks, now i want to add simple red blush on cheek.
I have prepared image for and overlap on cheek, it work with white face but when i use dark face then it show me like jokar, which it not corrrent,so the blushing should be depends on skin color.if there any way to dynamic image as attached.
Can any one let me know how can i do that.
Thank you in advance.
Not a precise answer, but I hope it guides you on the right direction:
Use a Paint with a Shader using Overlay or Multiply to blend the face bitmap with the blush bitmap
Try using cv2.seamlessClone() function, it has pretty good results at embedding pictures after alpha blending. I'm sure it will look much better.
I need to create the painting application for the kids where kid can colour inside the black bordered sketch of any image
But, I am struck with the problem,that colouring can come outside the black bordering of the image...which i don't want to.Please guys help me to find out how to restrict the colouring by user within the black border of sketch
Also, I want that no colour should cover the black border.it should be inside the border.
I can post my code if required.
Look at Canvas clipPath and use the clipping built in to android to limit the 'coloring' of the kid/user to the regions you specify. You can then draw your objects as layers, kid/user colored layer on bottom, your sketch on top.
Finally..i have implemented it using mask bitmap and right usage of Portet.Duff mode
I want to implement red eye removal application on android. Is there any api or built in android method to do this? If no then please tell me how can we detect eyes from image? I know how to remove red color but Im having difficulty in detecting eyes from image.
Use the OpenCV to detect the eyes and then in the circular region where you expect the pupils to be, take the pixel value and set the Red value to, say, 20% of its original value while leaving the Green and Blue channels untouched.
There is also the FaceDetector.findFaces() which works for Bitmaps. However, it will just give you a Rectangle of the Face. But it should be easier to search in that rectangle for red-saturated pixels and desaturate the color as Alexander suggested. But this way you don't necessarly need another library.
I'm searching how to set own bitmap like stylus of my path which I draw on canvas. This is exactly implemented in Sketchbook and it is perfect. Which classes I must use? Can you recommend me some solution, please?
easy now.
What I want eventually:
I want to have 2 bitmaps overlayed on a view. Same bitmaps with the one above have higher brightness than the below one.
Now when the user strokes(with touch event (like paint brush)) on the upper bitmap, I want those parts of the upper bitmap to go invisible.
For those who are familiar with adobe photoshop perhaps this will make more sense:
I want to draw a mask on an image being display so that only the unmasked parts remain visible. But the mask can be drawn from a brush with variable hardness/size.
How do I achieve this functionality? Direct me in in the line where I should research or give sample code.
Also, is it possible to draw strokes on an imageview with a brush which has variable hardness? I know that I can drawPath and drawArc on a canvas, but I do not know how to achieve the different brush strokes/styles.
Please pardon me if I haven't phrased my question right, or wasn't able to find similar duplicates.
You can use FrameLayout to overlay one image over other in Android and for Custom Masking search FingerPaint on google.
I think the best way is to do your own off-screen compositing, then render the composited image using an ImageView or perhaps a subclass with custom interaction. See this sample code for an example of how to do such compositing using the Porter-Duff transfer modes.