I am working on an Image editing app, I have done almost everything that is cropping, re-sizing, filters e.t.c but I cannot seem to really figure out how I can remove image background,the basic idea is the image will have a distinct background e.g subject can be grey and background white or vice versa, I tried looking up here and other sites but could not really find anything matching my description the closest thing was to use OpenCV which did not really do the job well, for the most part it was slow (using GrabCut), if anyone has tried this before or knows how to please help thanks in advance.
You can iterate over your bitmap through all pixels. And check if pixel color value is near in color value of your established background color. And change those pixel color values to transparent etc.
Edit: this answer may be useful
Related
I am new to tesseract.
The image provided is just an example, the actual image is an Identity Card.
I have a question. I would like to change the background colors to a specific color. Let's say 'black' but the text color remains the same. Is it even possible? I am not sure what exactly I am supposed to be learning in order to achieve it.
The purpose of converting the image color is because when I run my tesseract on my ID, It displays some weird symbols. This is because the ID consists of background designs. Any guides will really be helpful ! Thank you !
UPDATE
Okay, I found this image from google search.
This will be the image that I will be loading into my application under ImageView. Is there any way that I can only keep the black text on the Identity Card and remove every other colors from the image to white, pixel by pixel? Can it be done ?
*Sorry for not providing a proper explanation previously! *
RelativeLayout background;
background = (RelativeLayout) findViewById(R.id.background);
background.setBackgroundColor(
ContextCompat.getColor(MainActivity.this,R.color.black));
I've been working on this problem for 2 days now. What I'm trying to achieve is to make a bitmap fill the complete non-transparent background of a 9patch drawable (a speech bubble in this case).
Instead of this
I want something like this
(Yes, bad photoshopping, but serves its purpose.)
Is that even possible? I cannot provide any code, as I don't have any that would make my problem more clear. Sorry about that.
Regards,
D.
OK, I've read a lot of tutorials and even downloaded some examples, but for the love of Stackoverflow, I can't get my image to stretch like I want it to and I'm hoping that someone can help me out here.
I create an image that is to be the background of a button object in Android. Here is the image:
Now, I'd like for it to stretch to the desire size of the button, whether the button is 50x50dp or 200x100dp. One thing I don't want is the border to stretch as it will look distorted, so I want to specify not to include the border, but stretch everything else to the desired size of the button.
Can someone please show me where the black lines need to go in order to achieve my goal? Do I have to change my original image in order to achieve my goal?
Thank you in advanced.
David
It's very simple using this tool Android Asset Studio: Simple 9-Path Generator. Although no matter how you do it you will have stretching and distortion due to the textured (non-patterned) background. I would stay away from that style both personally and for usability.
I recently downloaded an app from the market called WunderList and it has this neat effect on a Edit Text for transparency
I am trying to recreating the same effect for one of my applications but I am not really getting anywhere. I initially thought it is just transparency but I was wrong. Now I have put an image with shadow as the EditText's BG an trying to set it's alpha. I am not sure If I am on the right path. I would appreciate any guidance on this.
I got this done through a custom 9patch image. Here's a sample result.
It's not close but I am getting closer.
That's actually the way we do it.
We use a 9patch PNG with transparency.
I have got another mysterious issue. So, I am setting a background image for LinearLayout. This image contains gradient. Don't know why, but after I launch application the image appears to consist of several parts that actually form "smooth transition" of gradient, and that's why it seems that background image is not a gradient.
Could you please advice how to fix this issue?
The emulator and many Android phones use a 16bit color palette. 65536 colors may not be enough to smoothly display your gradient.