Page 1 of 1

Remove grid from map

Posted: 2019-11-01T13:33:03-07:00
by rl90599
Hello, I'm making a "cylindrical" projection of Jupiter's moon Ganymede. But there is one problem, the image/map consists of a grid that is divided into 36 columns and 16 rows that I cannot painfully remove (because it takes a lot of time). What kind of ImageMagick commands can remove the grid partially or fully?

Here's the image:Image (Note: the white/blank areas with the grid were removed and filled. The image is also contrasted to show the grid.)

Re: Remove grid from map

Posted: 2019-11-01T14:05:09-07:00
by snibgo
The best that could be done with this image is to make all the pixels on gridlines transparent, then use a hole-filling technique.

You can probably find the grid lines by scaling to a single row and searching for peaks. That will give the locations of the vertical lines. Repeat in the other direction.

But I expect that better source images are available.

Re: Remove grid from map

Posted: 2019-11-01T16:13:01-07:00
by rl90599
snibgo wrote:
2019-11-01T14:05:09-07:00
The best that could be done with this image is to make all the pixels on gridlines transparent, then use a hole-filling technique.

You can probably find the grid lines by resining to a single row and searching for peaks. That will give the locations of the vertical lines. Repeat in the other direction.

But I expect that better source images are available.
Can you show me an example please? I haven't did this technique rather than using the clone/stamp tool to get rid of the grid in a paint program. Also, is there a possible way that an ImageMagick command could do this automatically, rather than taking a lot of time doing the "hole-filling" technique?

Re: Remove grid from map

Posted: 2019-11-01T19:35:47-07:00
by Werty
Out of curiosity, how come you use such an old image, there are better versions available like this one...

https://imgur.com/a/9LFaoVJ

I use them in a solar system simulator i'm working on using the Irrlicht 3D engine.

Lots of high res solar system images (textures) available at http://celestiamotherlode.net/

Sorry for semi off topic :)

Re: Remove grid from map

Posted: 2019-11-01T19:47:58-07:00
by rl90599
Sorry for off topic stuff, but I like using old/vintage maps for my Ganymede map. Anyway, is there a command for ImageMagick to partially remove the grid?

Re: Remove grid from map

Posted: 2019-11-01T19:52:46-07:00
by fmw42
Not directly. You would have to script it. User snibgo has code for doing the inpainting. ImageMagick does not have that yet. But there are other tools that can do the inpainting. You would need to make the grid lines transparent in some of them or some special color in others. But ImageMagick can draw color lines if need be.

Re: Remove grid from map

Posted: 2019-11-01T20:57:20-07:00
by rl90599
Not directly. You would have to script it. User snibgo has code for doing the inpainting. ImageMagick does not have that yet. But there are other tools that can do the inpainting. You would need to make the grid lines transparent in some of them or some special color in others. But ImageMagick can draw color lines if need be.
So, if I manually make the grid transparent or color it, will the inpainting script work?

Re: Remove grid from map

Posted: 2019-11-01T21:15:04-07:00
by fmw42
You will need to confirm with snigbo. See http://im.snibgo.com/fillholes.htm and http://im.snibgo.com/fillholespri.htm. I believe they are c code that needs to be integrated with ImageMagick to work.

There are also inpainting routines in Python Skimage and Python or C++ OpenCV.

Re: Remove grid from map

Posted: 2019-11-01T21:24:12-07:00
by rl90599
Here's the picture with the grid removed: Image

So, how do integrate snigbo's inpaint code into ImageMagick? I use ImageMagick on Cygwin since I'm using Windows as my operating system.

Re: Remove grid from map

Posted: 2019-11-01T21:25:24-07:00
by fmw42
Read the links I gave you. He has instructions or contact him. I have not used it before.