Android Question Auto cropping image

Matteo Granatiero

Active Member
Licensed User
Longtime User
I would like to automatically crop an image by removing the background like this:
 

Attachments

  • 54224BC9-6F43-45DB-A6E3-0BACDA781F5E.jpeg
    54224BC9-6F43-45DB-A6E3-0BACDA781F5E.jpeg
    31.9 KB · Views: 440
I think it needs AI or some kind of algorithm to achieve it.
My first thought: LOL

My second thought: Oh, @aeric might mean actually removing background like this:
1583306183432.png


My interpretation of the non-question was this:
1583306251531.png

Meaning, removing background by cropping using a bounding box. (Shown as red outline here.)

We'll see if @Matteo Granatiero adds some background (pun intended) and perhaps even a question.
 
Upvote 0
My first thought: LOL

My second thought: Oh, @aeric might mean actually removing background like this:
View attachment 89513

My interpretation of the non-question was this:
View attachment 89516
Meaning, removing background by cropping using a bounding box. (Shown as red outline here.)

We'll see if @Matteo Granatiero adds some background (pun intended) and perhaps even a question.
yes this is my question, sorry if I haven't been clear and specific ahaha
 
Upvote 0
So, to be clear, you're looking to do this: Automatically crop an image to the bounding box?
1583309462429.png


It seems to be a quite simple problem to solve, what have you tried and what are your questions?
 
Upvote 0
This sounds like it could be a job for OpenCV.

There have been a few ports to OpenCV for B4A over the years. There may be a function that allows you to isolate an object within an image – I'm not sure.

As someone else posted, this seems straightforward but it is an incredibly difficult problem.

Barry.
 
Upvote 0
but this is only to eliminate the transparent background, but in case of NOT transparent background?
This is only for transparent background, that's why I wrote that it is only "a bit related".
BTW, the image from the first question can be handled with a similar code. As already written several times there is a huge difference between removing a solid color background and removing real world background. These are completely different tasks.
 
Last edited:
Upvote 0
Upvote 0
Back
Top