Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-09-2014, 19:18   #1
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
ImgCalKap- From raster to kap graphical convertion tool

Hello all

I finished to code a graphical conversion tool for raster to kap, capable of zooming and panning, that let you choose an image file of a raster map (bmp, png, etc), insert some calibration marks (at least two), generate a kap header file and pass the data to the imgkap command line tool for generating a kap file to use with OpenCPN.

The software is under GPL license, the source code is there, and runs on windows for now. If there is enough interest, I could start a Linux porting.

Download source and binaries from here: http://www.dgiardini.com.ar/imgcalkap/

I also included the imgkap.exe binary in the zip. I couldn't contact MdJ, the author of this great tool; so, if he or someone else considers I'm violating some software right please let me know and I'll remove it from the zip.

Feel free to send feedback to dgiardini at gmail.com

Regards, David
__________________

__________________
piluso is offline   Reply With Quote
Old 09-09-2014, 23:00   #2
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,016
Re: ImgCalKap- From raster to kap graphical convertion tool

David...
I don't think MdJ will have any problem with it, we haven't heard from him for quite some time, but as I understand (and as the comment in imgkap.c suggests), the imgkap source code is in public domain.
It would definitely be cool to make your code run natively on other platforms - it's where a native calibration tool is actually missing.

Few notes about my brief experience under Wine:
- I got a crash under while trying to open a (pretty big) real world JPG chart:
Code:
OpenCV Error: Null pointer (The matrix has NULL data pointer) in cvGetMat, file C:\User\VP\ocv\opencv\src\cxcore\cxarray.cpp, line 2375
- The GUI would probably deserve a bit more work - It is for example not clear at all what the format for lat/lon should be as both the fields have the same "Lat"/"Lng" label. Is it Degrees in the first and decimal minutes in the second field?
- The "Zoom" window, once closed, immediately reopens, but with different shape and size and 50% of it is covered with artifacts of the underlying screen.
- It hates filenames with spaces.

Pavel
__________________

__________________
nohal is online now   Reply With Quote
Old 10-09-2014, 14:48   #3
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Pavel

Thanks for the feedback, I will start porting the code to Linux hoping will be useful to the OpenCPN community.
I don't know if starting a new thread with news about this tool fits in this forum, I'll appreciate any advice about how and where to communicate changes

David
__________________
piluso is offline   Reply With Quote
Old 10-09-2014, 17:52   #4
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: Masachusetts
Boat: bristol 27
Posts: 2,803
Re: ImgCalKap- From raster to kap graphical convertion tool

Consider the weather fax plugin already can perform this task.

It is probably much better since it corrects aspect ratio to make it correct for mercator, and can also convert other coordinate systems like polar and ellipsoidal into meractor.

I plan to split the weather fax plugin into two plugins, one for weather fax, the other for chart editing, to easily modify charts.
__________________
boat_alexandra is offline   Reply With Quote
Old 10-09-2014, 19:15   #5
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Dear boat_alexandra

It's great to have a tool inside OpenCPN, and in fact, would be great if you make a plugin for easy chart editing.

Anyway, already did what I did, and doesn't hurt to me make some extra effort to get that simple application working on Linux. And of course, there is plenty of room for improvements.

Please go ahead with your chart map plugin! And the application I coded should find their own path among users, or just be forgotten if it doesn't fit their purpose

Regards, David
__________________
piluso is offline   Reply With Quote
Old 11-09-2014, 19:40   #6
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: Masachusetts
Boat: bristol 27
Posts: 2,803
Re: ImgCalKap- From raster to kap graphical convertion tool

I would rather avoid duplicated efforts and work together toward a goal to combine our work.
__________________
boat_alexandra is offline   Reply With Quote
Old 13-09-2014, 10:20   #7
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

// I would rather avoid duplicated efforts and work together toward a goal to combine our work.//

Agree. What do you suggest to start a combined work ?

Regards, David
__________________
piluso is offline   Reply With Quote
Old 13-09-2014, 11:37   #8
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,356
Re: ImgCalKap- From raster to kap graphical convertion tool

Dear Puluso (David)

Perhaps you could fork Weatherfax on github and get your translator working in your fork?
https://github.com/seandepagnier/weatherfax_pi

Please see Tracker "Weatherfax" project at the dropdown, for a list of where Sean has brought the plugin. It is really quite good.
OpenCPN::Tracker pi - WeatherFax: Tasklist


Additionally I suggest you give it a try to learn more about how it works.
You need current beta 3.3.2107

You can get the recently compiled windows version here
Opencpn Beta File thingie rguser rgpass
If you use linux you can compile it yourself.

Sean has indicated that he would like to make the plugin read kap as well as save kap (which it does now). Then once an image file is properly aligned and georeferenced from SSB or Internet or File sources, it would be converted to KAP (with all the georef info) and then it can be auto saved and recalled as an overlayed image on the Opencpn charts without having to go through the Wizard again to reset the georefs.
Please note FS#1449 : Add Kap read /write and save all current overlaid images to KAP to preserve lat long data. -All Sailors should VOTE for this feature. It will make your life much easier!

Currently the plugin handles internet weatherfaxes beautifully, click on the 24 hr surface analysis for example and it downloads and instantly overlays on the chart properly.

However close Opencpn and you have to download the image file again or go through the Wizard to set up the georeferences, or recall which one of the Coordinate settings you saved for the image. Kap read/write of kap files will make use easier.

Hope you can help Sean to move this plugin forward. Thanks.
__________________
rgleason is offline   Reply With Quote
Old 13-09-2014, 18:16   #9
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Dear rgleason

Now I see there's a lot of information I couldn't see before; all the details you provided are very useful to me, and for anybody who wants to help and contribute.

I'll start at the point you suggest, forking and modifying the weatherfax plugin. I hope could help to improve the map calibration process.

Thanks, David
__________________
piluso is offline   Reply With Quote
Old 13-09-2014, 18:23   #10
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: Masachusetts
Boat: bristol 27
Posts: 2,803
Re: ImgCalKap- From raster to kap graphical convertion tool

Quote:
Originally Posted by piluso View Post
// I would rather avoid duplicated efforts and work together toward a goal to combine our work.//

Agree. What do you suggest to start a combined work ?

Regards, David
I guess starting with feedback of weatherfax program using it to make kap charts.

A few things I would like to see but didn't implement:

1. perspective correction for paper charts taken with a digital camera (because of the slight angle of the camera)
2. Color filters etc to enhance chart.
3. Lossy tiff compression (like lossy png compression) to reduce file size.
__________________
boat_alexandra is offline   Reply With Quote
Old 13-09-2014, 20:21   #11
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Quote:
I guess starting with feedback of weatherfax program using it to make kap charts.
Was a long way, hours of googling, installing and trying programs, until I asked here and you told me that the weatherfax plugin could make kap files. It's no evident for and end user like me that a plugin named weatherfax could also be used as a map calibration tool.

Quote:
1. perspective correction for paper charts taken with a digital camera (because of the slight angle of the camera)
2. Color filters etc to enhance chart.
3. Lossy tiff compression (like lossy png compression) to reduce file size.
These are advanced features, while still there is a lack of a tool similar the users of OziExplorer or SeaClear already have,with marks, zoom, pannning, limits, retrieving a previously calibrated map,and so .

I must say that _my_ need of this tool, is because the source of charts of my zone are a lot of files covering the Paraná River, the River Plate, Uruguay, what I have to merge and re-calibrate to be usable within OpenCPN. As you see, I'm in a basic situation that needs simple features; but I guess many users too.

I want to do something about this, (like the little software that started this thread) and at this time I see three alternatives:

- Wait for you to start the calibration map plugin
- Fork your plugin and try to modify it
- Keep working in my software hoping help others (because for _me_, as is enough)

I'll appreciate your comments.

Regards, David
__________________
piluso is offline   Reply With Quote
Old 13-09-2014, 21:09   #12
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: Masachusetts
Boat: bristol 27
Posts: 2,803
Re: ImgCalKap- From raster to kap graphical convertion tool

Quote:
Originally Posted by piluso View Post
Was a long way, hours of googling, installing and trying programs, until I asked here and you told me that the weatherfax plugin could make kap files. It's no evident for and end user like me that a plugin named weatherfax could also be used as a map calibration tool.
I believe it is stated in the description, but it is not very obvious. A chart editor plugin is needed.
Quote:
These are advanced features, while still there is a lack of a tool similar the users of OziExplorer or SeaClear already have,with marks, zoom, pannning, limits, retrieving a previously calibrated map,and so .

I must say that _my_ need of this tool, is because the source of charts of my zone are a lot of files covering the Paraná River, the River Plate, Uruguay, what I have to merge and re-calibrate to be usable within OpenCPN. As you see, I'm in a basic situation that needs simple features; but I guess many users too.
Another feature I want to add is the ability to set the boundary coordinates, or clipping region.
Quote:
I want to do something about this, (like the little software that started this thread) and at this time I see three alternatives:

- Wait for you to start the calibration map plugin
- Fork your plugin and try to modify it
- Keep working in my software hoping help others (because for _me_, as is enough)

I'll appreciate your comments.

Regards, David
I tried your program, and I like the zoom window and zooming ability, but I believe the chart plugin will simply use the builtin zooming in opencpn to achieve this result. Currently the weatherfax plugin doesn't support this.

Maybe it's best to wait for my calibration plugin. I intend also to support drag and drop of the calibration points to make it very easy to align to tracks, google earth images, and other charts.

I think normally only two points are needed (expanded automatically to 4 points by the program to satisfy kap requirements), but in the case of distorted charts, more could be used, but then the chart is not going to be very accurate.
__________________
boat_alexandra is offline   Reply With Quote
Old 16-09-2014, 17:17   #13
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Quote:
Maybe it's best to wait for my calibration plugin
Ok, meanwhile I'll going on with the imgcalkap program

Quote:
I would rather avoid duplicated efforts and work together toward a goal to combine our work
Agree, so I will follow this direction:
Use the imgkap.c file and compile with my program.
Make it able to open images and kap files for editting.
Keep portability in mind

Share the code, probably you can take some lines from there for your new plugin.

Regards, David
__________________
piluso is offline   Reply With Quote
Old 24-09-2014, 20:06   #14
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,356
Re: ImgCalKap- From raster to kap graphical convertion tool

David:
Quote:
Agree, so I will follow this direction: Use the imgkap.c file and compile ImgCalKap program . Make it able to open images and kap files for editing. Keep portability in mind. Share the code, probably you can take some lines from there for your new plugin. David

David, I hope you will become familiar with Weatherfax code so you can help Sean later with programming!
Also we really need a good Windows programmer. Sean's focus is Linux, he has been putting up with my bumbles and now has Windows, but would really appreciate someone who could help with some of the windows issues we run up against, that are particular with windows and MSVC++!

Sean
would like to start with feedback of weatherfax program using it to make kap charts, so I am going to try to summarize thoughts from your and Sean's comments:

David said
  1. Need tools similar to OziExplorer or SeaClear with marks, zoom, pannning, limits, retrieving a previously calibrated map, etc
  2. When the charts are many files (covering a complex area) need to be merged and re-calibrated for Opencpn use, a basic situation that needs simple features
ImgCalKap Plugin
  1. Graphical conversion tool for raster to kap, capable of zooming and panning, choose an image file of a raster map (bmp, png, etc), insert some calibration marks (at least two), generate a kap header file and pass the data to the imgkap command line tool for generating a kap file. GPL, runs on windows for now could port to Linux. http://www.dgiardini.com.ar/imgcalkap/
  2. Experience under Wine:
  3. - crash while trying to open a (pretty big) real world JPG chart
  4. - GUI would probably deserve a bit more work - eg not clear format for lat/lon degrees + decimal minutes?
  5. - Zoom window, once closed, immediately reopens, but with different shape and size and 50% of it is covered with artifacts of the underlying screen.
  6. -It hates filenames with spaces.
  7. Re use of imgkap.c (imgkap source code is in public domain).
  8. Nohal: Yes, Make your code run natively on other platforms - it's where a native calibration tool is actually missing.
Weatherfax Plugin
  1. Open, File, Image and sound and decode the sound files, Wizard converts to mercator, adds georeference, overlay on chart.
  2. Retrieve, internet image files using preset urls, with preset georeference added, overlay on chart.
  3. Retrieve, Audio Capture, decode sound to fax file, using sound card & HF device*, Wizard adds georef, overlay on chart.
  4. *control of HF device needs to be added, but Sean needs a SSB to do this.
  5. Round trip with Kap, Read kap and save kap (does now).
  6. Wizard after fax is aligned and georeferenced from Radio, Internet or File sources, Converted to KAP (with all the georef info) with autosave to be able to recall as overlay on chart without need of the Wizard.
  7. Not evident that Weatherfax can be used as a map calibration tool and make kap files.
  8. ImgCalKap has zoom window and zooming ability which is liked, Weatherfax will soon simply use builtin Opencpn zooming.
  9. Would be great if you make a plugin for easy chart editing.
  10. Sean plans to split the weather fax plugin into two plugins, Weatherfax & Chartedit.
  11. Consider the weather fax plugin already can perform this task.
  12. It is probably much better since it corrects aspect ratio to make it correct for mercator, and can also convert other coordinate systems like polar and ellipsoidal into meractor.
ChartEdit - Calibration Plugin
  1. Drag and drop of the calibration points to make it very easy to align to tracks, google earth images, and other charts.
  2. Normally only two points are needed (expanded automatically to 4 points by the program to satisfy kap requirements),
  3. In the case of distorted charts, more could be used, but then the chart is not going to be very accurate.
  4. Ability to set the boundary coordinates, or clipping region.
  5. Perspective correction for paper charts taken with a digital camera (because of the slight angle of the camera)
  6. Color filters etc to enhance chart.
  7. Lossy tiff compression (like lossy png compression) to reduce file size.
__________________
rgleason is offline   Reply With Quote
Old 26-09-2014, 06:07   #15
Registered User

Join Date: Aug 2014
Location: Argentina
Boat: H20
Posts: 55
Re: ImgCalKap- From raster to kap graphical convertion tool

Dear rgleason
Quote:
David, I hope you will become familiar with Weatherfax code so you can help Sean later with programming!
I already looked at the Sean code, it's great and uses imgkap work too; so I think I could help with some coding.
Quote:
I am going to try to summarize thoughts from your and Sean's comments:
Your list is a good point for working on common objectives. I think I'll visit your post many times to see how to continue :-)

In these days I was reworking the imgcalkap program, so now it can open Kap files, get the calibration points and the boundaries of the chart for editting, and save it as kap again; besides the image calibration already done. I hope next week I'll finish this step, and perhaps, I could introduce the read kap feature into the Sean plugin, and give him the code for his evaluation.

I switched the program to wxwidgets, so it can be compiled and running on Linux.
I'll be in touch, and let you know the work progress

Regards, David











__________________

__________________
piluso is offline   Reply With Quote
Reply

Tags
cal

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RASTOW, a tool to classify raster charts marinux OpenCPN 2 05-02-2016 12:01
Imgkap - kap File Converter Tool MdJ OpenCPN 222 12-11-2015 17:15
Raster to Kap Graphical Convertion Tool piluso OpenCPN 5 27-08-2014 06:08
Kap testing tool? avant OpenCPN 4 02-07-2014 22:00
Let's See Your Boat's Workbench, Tool Shed, Tool Box . . . Ocean Roads Construction, Maintenance & Refit 46 12-10-2010 17:22



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 04:45.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.