How to check if an image contains an element I am searchig for

Chris Angelico rosuav at gmail.com
Wed Jun 16 17:43:30 EDT 2021


On Thu, Jun 17, 2021 at 7:35 AM Dan Stromberg <drsalists at gmail.com> wrote:
>
> On Wed, Jun 16, 2021 at 2:04 PM Barry <barry at barrys-emacs.org> wrote:
>
> > >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael <arakelt... at gmail.com>
> > wrote:
> > >>>
> > >>> Hi guys,
> > >>>
> > >>> I have an image from google maps to say and I need to check if it has
> > road markings, in order to do that, I believe I need to change the effects
> > on the image so the markings and road can be white or something and the
> > things I don't need like cars, trees and so on to be black.
> > >>>
> > >>> images should contain only road surface and/or road markings (lines,
> > zebras, stripes.
> > >>>
> > >>> Can anyone help me on this, I already have the crop code, I just need
> > to check if the cropped part contains what I need.
> > >> How well can you define the things you're looking for?
> > >>
> > >> https://xkcd.com/1425/
> > >>
> > >> ChrisA
> > > Hi Chris,
> > >
> > > what do you mean?
> >
> > He means that image processing is a hard problem that requires expertise
> > to solve.
> >
> > >
> > > Here is the image, I need to separate the road and markings from the
> > rest and divide the image into squares of 100x100 pixels, for each square I
> > need to check if it contains a road and markings:
> >
> > Can you define road in terms of an algorithm that looks at the pixels?
> >
>
> I think that XKCD may be a little out of date.

It's not out of date. The task still requires a lot of effort - it's
just that the effort is now "preparing a suitable corpus" rather than
"figuring out how on earth to do this". Even with all the tools at our
disposal, there's still a stark (and often surprising) distinction
between the easy and the hard.

For instance, calculating square roots is pretty hard to do by hand,
but computers don't have any trouble with that. But "what's that song
about blah blah blah" is incredibly difficult, and if you try to write
your own tool to do that (rather than doing what most people would do,
and type something into a search engine!), you'll find that it's far
easier to just give the job to a human.

> You could probably train a Deep Learning model to do this, if you have
> enough prelabeled data with enough variation.

That is, in fact, the exact difficulty.

> And of course dividing a picture up into 100x100 squares is pretty easy if
> you convert to ppm.  Perhaps Pillow can do this too.

Sure, but that's the trivially easy part. And probably not even all
that helpful in the scheme of things.

ChrisA


More information about the Python-list mailing list