how can i detect image in transparent image? - android

As you can see in the picture, a drawing has been made on a transparent canvas, I want to scan the line on the canvas I want to make in pixels and find out its location and size, how can I do this?
Click to see the picture

Related

Draw a rectangleBox on CameraX preview and capture only that area

I want to open the camera with a rectangle border over it. And capture only the rectangle area image. The rectangle border can resize as per the user's choice.
Tried with many SO link but still no answer.
Below is the SO link that I want to achieve.
Display a rectangular bounding box (overlay) on custom Camera2 API so only the image inside the box is captured

Android How to set the imageview in front of drawingview

I am using drawing view to draw on touch of user , So I need to put the image in front of it. There are some letters written in the middle of image , which is in translucent , while the other places are covered with color. So on touch the user would only see the letter filling with paint as the letter is transparent and translucent.
Edited
is the picture, I want to fill the only white space with color on user touch. Right now I am painting on a white canvas and , truly I have copied the code of touch to draw from android api demo folder. So please Tell me How to fill that white blank space only .
I came up with idea and that is to draw canvas as the source code of api demo is doing , and just put the imageveiw in front of this canvas hence user would only see the white area is filling with color. Any idea that How can I perform this ?
So My major problem is how to put that image view in front canvas in android. ?

Bluring Part of an Image in Android

is there any way to blur only part of an image in android?
searched a lot but dint find any help.
most of the examples use gaussian blur which blurs full imageview.
i want to allow user to dynamically draw rectangle on imageview & on action up
area within rectangle should be blured.
any help will be really appreciated.
Bluring images on the fly is not an easy task, ask Roman Nurik (The one behind Muzei app)
He gave useful tips on this Google+ post but it's for animated images, from focus to blur.
In your case, I would say that you need to (roughly):
Get the bounds of the drawn rectangle
Get the image part that corresponds to the previous bounds
Blur on the fly the previous image part
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle and do again step 1
EDIT: After re-thinking about it, computing and draw a blurred area each time the drawn rectangle move it too heavy, it won't work. The solution is probably this:
Blur the entire image and keep it into memory
Get the bounds of the drawn rectangle
Get the part of the blurred image that corresponds to the previous bounds
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle to do again step 2-3-4
put the image view in a relative layout.
you detect the touch events of the user.
for each rectangle that he is drawing, you add an image view of it is size superposed to the initial one (I mean in the same relative layout) and of course with your blur effect.
you will see your image view blured part by part ...
put another layout on the half part of the image and set a translucent type background to the layout.
Once you have drawn your rectangle set alpha = 0.5 or as per your need so that your dynamic view that you have drawn will look blurred.
This is code for blur:
http://shaikhhamadali.blogspot.in/2013/07/gaussian-blur-imagebitmap-in-imageview.html
In this code computeConvolution3x3 method is used for computing the blur.For computing blur it convert the bitmap in to pixel array then it apply on those pixel. So you have to just do is get pixels array of that part of the image that you want blur.

android - How to fit circle image in another circle image

I have a circle image(image1) and i am getting one more circle image(image2) dynamically. Now i want to fit the image2 in the image1. is it possible?if yes, How can we implement it.
Image1
You should be able to draw it within the bounds of the canvas of your image. Specifically you can grab the width/height of the second image and then change the drawing positioning of your bitmap by drawing it manually on a canvas and then controlling the X/Y offsetting during the drawing procedure.
Something like this
This is if your source image is at a fixed resolution (ideal). The concept would be to build the image using the Canvas object and then superimpose the other image on top of it. And build a bitmap from that.

Draw on imageview image in android?

Fellow Programmers,
I am new to android and I am trying to draw on a image based on giving the x and y axis of the image as the input.So that he pixel value corresponding to the coordinate gets filled with a color that I mention. Say Red color for now.
User Story: Render a image through image view and on a button click I need to pass the co-ordinate value for the image that represents the pixel of the image and fill it with red color. Keep on doing it looks like drawing on the image that I render using image view.
Is this user story is possible to do in Android? If then help me on this. I referred the draw class and canvas class and not sure how to implement.
Looking forward to ur help on developing this user story on android application.
Best,
Googler
Take a blank canvas.
Draw your image on the canvas.
Draw points on the canvas by specifying x and y co-ordinates and red color in paint.

Categories

Resources