Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keogram li #751

Merged
merged 10 commits into from
Nov 3, 2021
Merged

Keogram li #751

merged 10 commits into from
Nov 3, 2021

Conversation

AndreasLMeg
Copy link
Collaborator

  1. new parameter -x (expands image to get the proportions of source)
  2. new parameter -c (show channel infos - mean value)
  3. text with black background
  4. show date
  5. calculate mean value only in the inner circle (mask) - without steetlights, cars,...

./keogram_li -d images/20211031 -e jpg -o test_li.jpg -x -c
test_li

daylight saving:
test_li

without changes:
test

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting nchan to 3 eliminates the crashes when there are some images with 1 channel and some with 3, but if all the images are mono it will "fix" them all to color.
I have a version of keogram.cpp that looks at the first image and uses it to determine the "nchan". I'll do a PR for that after your PR is merged.

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There shouldn't need to be commas between the three values. All the scripts that call keogram put the color values in quotes so getopt sees it as one argument that happens to have two spaces in it.
Do you have different scripts that don't put quotes around the color numbers?

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the "x" and "c" options to "usage_and_exit()".

@AndreasLMeg
Copy link
Collaborator Author

There shouldn't need to be commas between the three values. All the scripts that call keogram put the color values in quotes so getopt sees it as one argument that happens to have two spaces in it. Do you have different scripts that don't put quotes around the color numbers?

yesterday I'have seen the problem of optarg with this parameter. Only >"255< was delivered as argument.
the change to 255,255,255 was a quick and dirty hack
have you checked the functionality of optarg with this parameter ?

@AndreasLMeg
Copy link
Collaborator Author

Please add the "x" and "c" options to "usage_and_exit()".

Done.

-x | --image-expand : expand image to get the proportions of source
-c | --channel-info : show channel infos - mean value of R/G/B

@EricClaeys
Copy link
Collaborator

@AndreasLMeg
First off, thanks for submitting this PR. I assume it implements your nice changes to keogram? I seem to recall you had an "addRows" argument, but that's not in this PR. Did you rename it?

Here's the command that executes on my Pi using the current software on Thomas' GitHub:

'/home/pi/allsky/keogram' -d '/home/pi/allsky/images/20211031' -e jpg -o '/home/pi/allsky/images/20211031/keogram/keogram-20211031.jpg' --rotate 0 --font-size 1.0 --font-line 1 --font-color '255 255 255'

We added a variable to config.sh to allow the user to easily pass arguments to keogram, it's called "KEOGRAM_EXTRA_PARAMETERS" (different name than you have but it does the same thing). Here's what I have:
KEOGRAM_EXTRA_PARAMETERS="--rotate 0 --font-size 1.0 --font-line 1 --font-color '255 255 255'"

What does your keogram command look like?

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, another option for the ' ' versus ',' is to allow either. It'll only add a couple lines of code.

@AndreasLMeg
Copy link
Collaborator Author

Setting nchan to 3 eliminates the crashes when there are some images with 1 channel and some with 3, but if all the images are mono it will "fix" them all to color. I have a version of keogram.cpp that looks at the first image and uses it to determine the "nchan". I'll do a PR for that after your PR is merged.

my suggestion: a parameter f
-f | --fixed-channel-number : define number of channels 0=auto, 1=mono, 3=rgb (0=auto)

pi@allsky:~/allsky_keogram_li/src $ ./keogram -d ~/allsky/images/20211031 -e jpg -C "255 255 255" -o test_li.jpg -x -c
OpenCV Error: Assertion failed (channels() == CV_MAT_CN(dtype)) in copyTo, file /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/core/src/copy.cpp, line 259
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-L65chJ/opencv-3.2.0+dfsg/modules/core/src/copy.cpp:259: error: (-215) channels() == CV_MAT_CN(dtype) in function copyTo

Abgebrochen

and now with the parameter -f 3
pi@allsky:~/allsky_keogram_li/src $ ./keogram -d /allsky/images/20211031 -e jpg -C "255 255 255" -o test_li.jpg -x -c -f 3
pi@allsky:
/allsky_keogram_li/src $

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, Once I do the PR to fix the crashes when there are both 1-channel and 3-channel images, the "auto" mode would then be based on the 1st image, which is what my fix looks at to determine what to use.

@AndreasLMeg
Copy link
Collaborator Author

@AndreasLMeg, Once I do the PR to fix the crashes when there are both 1-channel and 3-channel images, the "auto" mode would then be based on the 1st image, which is what my fix looks at to determine what to use.

Unfortunately, the RaspHQ camera is always overexposed = WHITE (sunrise / sunset)
This means that the first pictures will always be mono. But I want RGB
I.e. your change will unfortunately not work for me
By the way: With the exposure control, this will no longer happen in the future

@AndreasLMeg
Copy link
Collaborator Author

I'm still trying to find the problem ...

here is the version 255,255,255

  • /home/pi/allsky/keogram -d /home/pi/allsky/images/20211031/ -e jpg -o /home/pi/allsky/images/20211031/keogram/keogram-20211031.jpg --font-size 2.0 --font-line 2 --font-color 255,255,255 -x -c
    optarg:<255,255,255>

and here "255 255 255" - You can see linux bash makes the Problem: changes "255 255 255" to '"255' 255 '255"'

  • /home/pi/allsky/keogram -d /home/pi/allsky/images/20211031/ -e jpg -o /home/pi/allsky/images/20211031/keogram/keogram-20211031.jpg --font-size 2.0 --font-line 2 --font-color '"255' 255 '255"' -x -c
    optarg:<"255>

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, when the HD camera outputs a white frame does it chang the number of channels to 1? The code is checking for imagesrc.channels(). If that's true, I could easily change it to look at the middle picture. I currently just have "0" hard coded for the file number.

Are you running the latrst files from Thomas? If so, run scripts/generateForDay.sk -k 20211031.
If you don't have the latest code, look in that script to see what it's doing and try the same on your Pi.
It's strange that bash is adding the single quotes. I wonder if that is country-dependant.

@AndreasLMeg
Copy link
Collaborator Author

AndreasLMeg commented Nov 2, 2021

@AndreasLMeg, another option for the ' ' versus ',' is to allow either. It'll only add a couple lines of code.

I think that's the best solution, but --font-color #FFFFFF is the very best

I haven't found the cause yet, but the problem already happens during import
source "$ {ALLSKY_CONFIG} /config.sh"

@AndreasLMeg
Copy link
Collaborator Author

@EricClaeys: That's enough adjustments for today - good starry night

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, I will be interested to see what the problem is since we have a lot of people in different countries. No one else has mentioned that issue though, and quite a few are using the newer config.sh.

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, Chris originally allowed only hex numbers but I got him to also allow 0-255 since not everyone is a programmer who understands hex, and the capture programs accept 0-255 so that's what people are used to. I think the capture programs should also allow both.

@EricClaeys EricClaeys self-requested a review November 3, 2021 02:04
Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make any additional changes in my PR, for example, allowing both "," and " ".

@AndreasLMeg
Copy link
Collaborator Author

AndreasLMeg commented Nov 3, 2021

@EricClaeys: I have now done various tests and have come to the result: It must be the keogram itself. And I can only imagine the new option handling as the cause. But I'm not very familiar with that - so I keep my hands off it
I suspect that this option "--font-color '255 255 255'" is rarely used. Can you do a test?

here is the keogram of last night (with activ gain control for RaspiHQ)
keogram-20211102

@EricClaeys
Copy link
Collaborator

@AndreasLMeg, how about if I merge your approved change in, then post my PR that eliminates the crashes when there are images of different channel numbers? I will also add in the ability to do either " " or "," separators for the font color.
I use "--font-color '255 255 255'" in my KEOGRAM_EXTRA_PARAMETERS variable since I find dark blue on black hard to see.

@AndreasLMeg
Copy link
Collaborator Author

@EricClaeys: That would be nice of you. But only if the ideas fit into Allsky's concept and it is an improvement.
I still think the idea with the "finishline" is good. But I'll make that available later.
For me, keogram is always the best way to get a quick overview of the night, which is why improvements are very important to me.
Thank you very much for your efforts.

@EricClaeys EricClaeys merged commit b59df74 into AllskyTeam:master Nov 3, 2021
@AndreasLMeg AndreasLMeg deleted the keogram_li branch December 4, 2021 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants