Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 2.00 average. Display Modes
Old 19-04-2011, 06:17   #1081
Registered User
 
sailias's Avatar

Join Date: Mar 2010
Location: Canada
Boat: On the Hard
Posts: 333
Re: Charts

Thanks...was not aware that you could not select individual files. Selecting the directory and all is back to normal.

/ch
__________________

__________________
sailias is offline   Reply With Quote
Old 19-04-2011, 10:37   #1082
Registered User

Join Date: Feb 2011
Posts: 490
Re: Charts

I have converted all the New Zealand Charts with the file converter provided and it works OK. What is the problem? I start to believe that the people are may be a bit lazy to do anything. By the way I am not a programmer and I would fancy having a possibility to adjust the boat size, like I did request in the forum. Most of the program I have been working with have such a facility.
Regards.
__________________

__________________
P_Dub is online now   Reply With Quote
Old 19-04-2011, 22:48   #1083
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
Hello Hamish,

try to put in a NZ chart following palette. It works fine.

Ciao, Marco.

Code:
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255
RGB/5,60,190,217
RGB/6,197,235,244
RGB/7,98,171,116
RGB/8,246,200,110
DAY/1,255,255,255
DAY/2,10,10,10
DAY/3,200,0,255
DAY/4,241,185,255
DAY/5,60,190,217
DAY/6,197,235,244
DAY/7,98,171,116
DAY/8,246,200,110
DSK/1,63,63,63
DSK/2,2,2,2
DSK/3,50,0,63
DSK/4,60,46,63
DSK/5,15,47,54
DSK/6,49,58,61
DSK/7,24,42,29
DSK/8,61,50,27
NGT/1,0,0,0
NGT/2,30,30,30
NGT/3,30,0,30
NGT/4,15,10,15
NGT/5,0,10,25
NGT/6,0,5,15
NGT/7,0,15,0
NGT/8,20,10,0
excellent! thanks. Looks great.

Is it just a matter of adding those to the header file before running tif2bsb? Is that something you'd be interested in doing for all the NZ charts for your next chart release, or should I write an awk script to chew through my local chart dir and apply manually?

I was at sea yesterday and based on last night's 4am watch, and based my earlier color-rules I decided that black-hole dark may actually be a useful color-step after all. Looking at these NGT values now in day they don't seem too dark to read in this light, which I think means they will be too bright on the night shift. (?) will need to test.

So I made one modification: instead of repeating RGB for DAY and having the first click of the OpenCPN sunset icon wasted doing nothing, I kept RGB as-is, dropped the values in DAY, and shifted the rest up one rank (so NGT->DSK, DSK->DAY), and filled NGT with a new darker version of itself:
Code:
NGT/1,0,0,0
NGT/2,20,20,20
NGT/3,20,0,20
NGT/4,12,8,12
NGT/5,0,8,22
NGT/6,0,5,15
NGT/7,0,11,0
NGT/8,15,7,0
It does not seem as pretty/clear as the others, and maybe it is better to have an extra step between dusk and night instead of a deep-night set?, but useful to take advantage of the available shading-level anyway, instead of having 2 day modes the say.


thanks!
Hamish
__________________
HamishB is offline   Reply With Quote
Old 20-04-2011, 06:25   #1084
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Re: Charts

Quote:
Originally Posted by HamishB View Post
excellent! thanks. Looks great.

Is it just a matter of adding those to the header file before running tif2bsb? Is that something you'd be interested in doing for all the NZ charts for your next chart release, or should I write an awk script to chew through my local chart dir and apply manually?
....
Hamish
Ciao Hamish, unfortunately the palette is added to the kap chart by the tif2bsb itself. No control on the palette before tif2bsb runs.

The only ways to modify palette are either to modify tif2bsb source code or to change the palette after kap generation (awk should be fine, but use bsbfix after awk for better kap compatibility)

On-field feedbacks on the (darkest) palette would be really appreciated.

Ciao, Marco.
__________________
GPS-Marco is offline   Reply With Quote
Old 20-04-2011, 13:11   #1085
MdJ
Registered User

Join Date: Jul 2010
Location: France
Boat: Etap 22i
Posts: 61
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
Ciao Hamish, unfortunately the palette is added to the kap chart by the tif2bsb itself. No control on the palette before tif2bsb runs.
If multiple users are interested I can add an option to do this automatically in imgkap.
(And I found a small error that I'm correct ...)

The idea is when there are fewer than 64 colors on the basis of the histogram, to write values ​​to DSK, NGT, or NGR GRY CRP and PRG.
With, for example at night, very clearly being used color becomes darker, and conversely a dark little used becomes clear ...

I need to know what is used or useful for OpenCPN.

M'dJ
__________________
MdJ is offline   Reply With Quote
Old 21-04-2011, 23:46   #1086
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Looking for a general solution to adding night-view codes to the NZ maps.

Step 1: check that all NZ charts use the same pallete.

tested with Marco's collection Ver27

Code:
$ grep -ah '^RGB/[0-9]\+,[0-9]\+,[0-9]\+,[0-9]\+' *.kap | sort | uniq

RGB/1,230,230,230
RGB/1,255,255,255
RGB/2,0,0,0
RGB/2,10,10,10
..
RGB/3,200,0,255
RGB/4,241,185,255
RGB/5,60,190,217
RGB/6,197,235,244
RGB/7,98,171,116
RGB/8,246,200,110
..
RGB/9,185,150,83
Rule 1 and 2 vary slightly in a few maps, but close enough to ignore.

Rules 3-8 are the same for all.

Rule 9 is only present in a few maps and is a dark-tan used for cultural,
or natural items of interest (e.g. names and years of shipwrecks, wildlife
species seen in the area; in NZ223 it is used to show edges of fisheries
management zones + EEZ). Can probabaly be set to a dark-grey at night
as not critical for navigational needs.

Code:
  RGB/1,230,230,230
NZ56.kap

  RGB/2,0,0,0
NZ14612.kap
NZ2681_1.kap
NZ2681_2.kap
NZ2681_3.kap
NZ2681_4.kap
NZ2681_5.kap
NZ4423.kap
NZ8215_1.kap
NZ8215_2.kap
NZ8215_3.kap
NZ8215_4.kap

  RGB/9,185,150,83
NZ223.kap
NZ286.kap
NZ7623.kap
NZ7654_1.kap
NZ7654.kap
(QGIS is nice for quickly checking the palette)


I was wondering what the other entries stood for, opencpn/src/chartimg.cpp says:
Code:
RGB, COLOR_RGB_DEFAULT
DAY, DAY
DSK, DUSK
NGT, NIGHT
NGR, NIGHTRED
GRY, GRAY
PRC, PRC  ??color??
PRG, PRG  ??grey??
S-57/S-52 has a number of other options.


Looking in the code I can only see DAY, DUSK, and NIGHT available for raster maps. So is the first press of the sunset icon a no-op, and thus why include RGB in the ColorScheme enumeration in ocpn_types.h?


Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 00:03   #1087
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by HamishB View Post
Looking in the code I can only see DAY, DUSK, and NIGHT available for raster maps. So is the first press of the sunset icon a no-op, and thus why include RGB in the ColorScheme enumeration in ocpn_types.h?
no, it's not a no-op. The sunset button cycles between RGB, DAY, DUSK, and NIGHT modes.
Before converting all my charts to 4 brightness levels I'd ask if the 4 levels are as intended, or will RGB/DAY be merged in future versions?


Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 00:20   #1088
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
Ciao Hamish, unfortunately the palette is added to the kap chart by the tif2bsb itself. No control on the palette before tif2bsb runs.

The only ways to modify palette are either to modify tif2bsb source code or to change the palette after kap generation
If we settle on something we like (ie how to treat DAY vs RGB?), would you be willing to use a patched version of "tif2bsb4nz" for your NZ distributions? I'm happy to redo them all for myself*, but may as well take the opportunity to help out everyone using NZ charts.

[*] (I already convert from .7z to .zip anyway as 99% of my colleagues don't know how to deal with 7zip and are scared of the warez'y looking download site, so an intermediary step to adjust the headers wouldn't be too much more work for me)


Quote:
(awk should be fine, but use bsbfix after awk for better kap compatibility)
thanks for the tip! I didn't know about that.

Quote:
On-field feedbacks on the (darkest) palette would be really appreciated.
Maybe a few weeks before I'm out at night again, I would guess dark palettes are somewhat subjective as everyone's eyes are a bit different. I'm quite light-sensitive so tend to favour the ridiculously-dark versions, but in general I think your DSK and NGT rules are probably just right.

Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 00:44   #1089
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
try to put in a NZ chart following palette. It works fine.
[...]
here's a slightly modified version of yours, with DAY replaced by a half-darkened version of RGB.

Code:
RGB/1,255,255,255
RGB/2,10,10,10
RGB/3,200,0,255
RGB/4,241,185,255
RGB/5,60,190,217
RGB/6,197,235,244
RGB/7,98,171,116
RGB/8,246,200,110
DAY/1,127,127,127
DAY/2,5,5,5
DAY/3,100,0,127
DAY/4,120,92,127
DAY/5,30,95,108
DAY/6,98,117,122
DAY/7,49,85,58
DAY/8,123,100,55
DSK/1,63,63,63
DSK/2,2,2,2
DSK/3,50,0,63
DSK/4,60,46,63
DSK/5,15,47,54
DSK/6,49,58,61
DSK/7,24,42,29
DSK/8,61,50,27
NGT/1,0,0,0
NGT/2,30,30,30
NGT/3,30,0,30
NGT/4,15,10,15
NGT/5,0,10,25
NGT/6,0,5,15
NGT/7,0,15,0
NGT/8,20,10,0
It now seems just right to me.

now to adjust the color of the moon and reflection of the water in the sunset button so we can see what that button does.. (usercolors[] in chart1.cpp ?)


thanks,
Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 01:15   #1090
MdJ
Registered User

Join Date: Jul 2010
Location: France
Boat: Etap 22i
Posts: 61
Re: Charts

Quote:
Originally Posted by HamishB View Post
If we settle on something we like (ie how to treat DAY vs RGB?), would you be willing to use a patched version of "tif2bsb4nz" for your NZ distributions? I'm happy to redo them all for myself*, but may as well take the opportunity to help out everyone using NZ charts.
Hello,

I don't know if you see imgkap.

I wrote a program in C that works under linux 32 64 bit Windows and should work on any platform, which replaces tiff2bsb, bsb2tiff ... who works with jpg, png ... and also compresses the colors ...

I propose to unite our efforts and I suggest this.

M'dJ
__________________
MdJ is offline   Reply With Quote
Old 22-04-2011, 01:33   #1091
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

here's a little bourne shell script to apply those night-mode rules to the NZ maps:

Code:
for CHART in *.kap ; do
  echo "[`basename $CHART .kap`]"

  if [ `grep -ahc '^NGT/1,[0-9]\+,[0-9]\+,[0-9]\+' "$CHART"` -ge 1 ] ; then
    echo "  Night palette already applied. Skipping ..."
    continue
  fi

  if [ `grep -ahc '^RGB/9,[0-9]\+,[0-9]\+,[0-9]\+' "$CHART"` -ge 1 ] ; then
    # this one goes to 9
    sed -i -e 's|^\(RGB/9,.*\)$|\1\nDAY/1,127,127,127\r\nDAY/2,5,5,5\r\nDAY/3,100,0,127\r\nDAY/4,120,92,127\r\nDAY/5,30,95,108\r\nDAY/6,98,117,122\r\nDAY/7,49,85,58\r\nDAY/8,123,100,55\r\nDSK/1,63,63,63\r\nDSK/2,2,2,2\r\nDSK/3,50,0,63\r\nDSK/4,60,46,63\r\nDSK/5,15,47,54\r\nDSK/6,49,58,61\r\nDSK/7,24,42,29\r\nDSK/8,61,50,27\r\nNGT/1,0,0,0\r\nNGT/2,30,30,30\r\nNGT/3,30,0,30\r\nNGT/4,15,10,15\r\nNGT/5,0,10,25\r\nNGT/6,0,5,15\r\nNGT/7,0,15,0\r\nNGT/8,20,10,0\r|' "$CHART"
    sed -i -e 's|^\(DAY/8,.*\)$|\1\nDAY/9,92,75,41\r|' \
           -e 's|^\(DSK/8,.*\)$|\1\nDSK/9,46,37,20\r|' \
           -e 's|^\(NGT/8,.*\)$|\1\nNGT/9,18,18,18\r|' "$CHART"
  else
    sed -i -e 's|^\(RGB/8,.*\)$|\1\nDAY/1,127,127,127\r\nDAY/2,5,5,5\r\nDAY/3,100,0,127\r\nDAY/4,120,92,127\r\nDAY/5,30,95,108\r\nDAY/6,98,117,122\r\nDAY/7,49,85,58\r\nDAY/8,123,100,55\r\nDSK/1,63,63,63\r\nDSK/2,2,2,2\r\nDSK/3,50,0,63\r\nDSK/4,60,46,63\r\nDSK/5,15,47,54\r\nDSK/6,49,58,61\r\nDSK/7,24,42,29\r\nDSK/8,61,50,27\r\nNGT/1,0,0,0\r\nNGT/2,30,30,30\r\nNGT/3,30,0,30\r\nNGT/4,15,10,15\r\nNGT/5,0,10,25\r\nNGT/6,0,5,15\r\nNGT/7,0,15,0\r\nNGT/8,20,10,0\r|' "$CHART"
  fi

  bsbfix "$CHART"

done
Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 07:39   #1092
Registered User

Join Date: Sep 2009
Location: Rome
Posts: 320
Re: Charts

Thanks Hamish.

Your script looks very nice but it would be great if you could write a C post-processing tool making the same (a C tool that I can compile for my poor windows O.S...).

The tool should accept as input one chart name and should convert the palette from RGB only to RGB, DAY,... I'd use it for the NZ main distribution once the best palette is agreed.

Ciao, Marco.
__________________
GPS-Marco is offline   Reply With Quote
Old 22-04-2011, 08:24   #1093
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
Your script looks very nice but it would be great if you could write a C post-processing tool making the same (a C tool that I can compile for my poor windows O.S...).
(just install MSys, and then the script can work from MS Windows too)

Quote:
The tool should accept as input one chart name and should convert the palette from RGB only to RGB, DAY,...
probably a -c flag to clear existing alternate palettes too.

well I could, but I expect it would be faster + more flexible to patch tif2bsb, or imgkap as suggested by M'dj? (imgkap is new to me, I'd have to find the code and take a look)


Hamish
__________________
HamishB is offline   Reply With Quote
Old 22-04-2011, 09:14   #1094
MdJ
Registered User

Join Date: Jul 2010
Location: France
Boat: Etap 22i
Posts: 61
Re: Charts

Quote:
Originally Posted by HamishB View Post
well I could, but I expect it would be faster + more flexible to patch tif2bsb, or imgkap as suggested by M'dj? (imgkap is new to me, I'd have to find the code and take a look)


Hamish
Code is on imgkap - Download
and with explanations on Imgkap - kap File Converter Tool

My C code is done on weekends and evenings, then it is not always very clean to read. I work with codeblocks on Linux.

Early in 2009 I tried to contact libbsb, the problem is that it is no longer active since 2004.
Otherwise I would have proposed to participate in the libsbsb project.

Regards
__________________
MdJ is offline   Reply With Quote
Old 22-04-2011, 23:38   #1095
Registered User
 
HamishB's Avatar

Join Date: Jan 2010
Location: New Zealand
Posts: 286
Re: Charts

Quote:
Originally Posted by GPS-Marco View Post
Your script looks very nice but it would be great if you could write a C post-processing tool making the same (a C tool that I can compile for my poor windows O.S...).

The tool should accept as input one chart name and should convert the palette from RGB only to RGB, DAY,... I'd use it for the NZ main distribution once the best palette is agreed.
try the attached. Tested with gcc on Linux.

100x more complex than by using the UNIX powertools, so possibly buggy -- perhaps bsbfix would catch any errors? (eg if '\nRGB/' randomly appears in the binary part of the map; should probably set a 'already_did_it' variable to avoid the rules being written beyond the header)


Code:
 USAGE: anp [-c] [-f] filename.kap
  -c flag clears any DAY/DSK/NGT rules from the file.
  -f flag tries to run bsbfix after changes to the header.
  A backup of the input file is written to filename.kap~
Hamish
Attached Files
File Type: doc apply_night_palette.c.doc (9.4 KB, 37 views)
__________________

__________________
HamishB is offline   Reply With Quote
Reply

Tags
charts, kml, raster2bsb, tiff2bsb, bsb

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
Charts on CD stxboy Navigation 43 28-01-2014 11:40
Charts for BC Charlie Navigation 11 19-04-2007 04:39
Used Charts daven Navigation 2 28-11-2006 17:47
Looking at charts - where to go to next Rippy Other 19 10-03-2006 05:27



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 15:57.


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.