Remove grid from map

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
rl90599
Posts: 5
Joined: 2019-11-01T13:15:21-07:00
Authentication code: 1152

Remove grid from map

Post 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.)

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Remove grid from map

Post 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.
snibgo's IM pages: im.snibgo.com

rl90599
Posts: 5
Joined: 2019-11-01T13:15:21-07:00
Authentication code: 1152

Re: Remove grid from map

Post 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?

Werty
Posts: 69
Joined: 2010-08-06T05:37:36-07:00
Authentication code: 8675308

Re: Remove grid from map

Post 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 :)
Windows 10 user

rl90599
Posts: 5
Joined: 2019-11-01T13:15:21-07:00
Authentication code: 1152

Re: Remove grid from map

Post 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?

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove grid from map

Post 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.

rl90599
Posts: 5
Joined: 2019-11-01T13:15:21-07:00
Authentication code: 1152

Re: Remove grid from map

Post 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?

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove grid from map

Post 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.

rl90599
Posts: 5
Joined: 2019-11-01T13:15:21-07:00
Authentication code: 1152

Re: Remove grid from map

Post 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.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Remove grid from map

Post by fmw42 »

Read the links I gave you. He has instructions or contact him. I have not used it before.

Locked