6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 2:51 pm

ethanol100 wrote:
6by9 wrote: Yes, max 4 lines. If you do much more then you're obliterating half your image.
not with font size 6 :)
But four lines and 256 characters are fine.
All right, I'll let you have 8 then - it's only a #define after all, and about 12 bytes of stack per line added when actually adding it the text.
ethanol100 wrote:Everything is YUV...
And we can't do yellow background with white fonts or black fonts on blue "YUV 0,255,0". I will never get a feeling of colours in YUV space...(Why is the intensity zero for a bright color?! (RGB=0,47,225))
I will look again at whether we can add the text to the U&V planes, but that code makes me want to run away and hide - comments were obviously considered an unnecessary inconvenience to the original author. I may get away with just writing the text again but at half the font size, but that has possibilities of bad artifacts.
ethanol100 wrote:And one example of the subsampling:
Annotation.jpg
The end of the first line has a darker blue line, the second one a almost white line. But it is really not important.
Yup, looks like we've either got an off-by-one at one end or another, or the offsets and widths aren't being rounded to a multiple of 2 before used. I did mention that this was originally just a quick debug feature, didn't I?!
ethanol100 wrote:Ok, if we do not want any replacement from bash -a 'text with "" and !\' will work fine, only if we have some variables we want to place in it like "Place: $home" we need to use double quotes. It is really not worth the effort.
I get to learn some more bash magic - thanks :)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20741
Joined: Sat Jul 30, 2011 7:41 pm

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 3:39 pm

Did I hear my name mentioned?

I'm not entirely happy with the bitmask approach to select what you want, but I was doing it in a hurry and it was the quickest way. Feel free to suggest alternatives.

What was the other issue?
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 3:49 pm

jamesh wrote:Did I hear my name mentioned?
Ears burning were they?! ;)
jamesh wrote:I'm not entirely happy with the bitmask approach to select what you want, but I was doing it in a hurry and it was the quickest way. Feel free to suggest alternatives.

What was the other issue?
ethanol100 wrote:
  • The test if the -a "string" is a number does not work as expected, i.e. if I want to write -a "1. Camera" will not display anything.
  • The "Annotate bitmask" needs some documentation, at the moment I guess you would need to look into the source to find its definition. I think many new user will have some problems.
Hence my suggestion of shifting the bitmask to another parameter rather than overloading -a.

I must admit to confusing myself initially with the overloading. I'd written my command line as raspisvid ... -a "Wibble" -a 1024 to try and turn on the background. By putting them in that order, I turned off the user text :(
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20741
Joined: Sat Jul 30, 2011 7:41 pm

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 4:44 pm

6by9 wrote:
jamesh wrote:Did I hear my name mentioned?
Ears burning were they?! ;)
jamesh wrote:I'm not entirely happy with the bitmask approach to select what you want, but I was doing it in a hurry and it was the quickest way. Feel free to suggest alternatives.

What was the other issue?
ethanol100 wrote:
  • The test if the -a "string" is a number does not work as expected, i.e. if I want to write -a "1. Camera" will not display anything.
  • The "Annotate bitmask" needs some documentation, at the moment I guess you would need to look into the source to find its definition. I think many new user will have some problems.
Hence my suggestion of shifting the bitmask to another parameter rather than overloading -a.

I must admit to confusing myself initially with the overloading. I'd written my command line as raspisvid ... -a "Wibble" -a 1024 to try and turn on the background. By putting them in that order, I turned off the user text :(
TBH, I never even envisaged having two -a's on the same command line! Does that really work?

I'll take a look when time allows, bit busy at moment, but it appears training trip to France next week has been delayed so may have some time.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 4:57 pm

jamesh wrote:TBH, I never even envisaged having two -a's on the same command line! Does that really work?

I'll take a look when time allows, bit busy at moment, but it appears training trip to France next week has been delayed so may have some time.
Yes, it works. They're processed as 2 independent command blocks one after the other. It was the only way I could see of turning the background on with my own text.

TBH I think the userland code is in good enough shape. I need to look into these couple of firmware quirks so will concentrate my efforts there. If others are worried enough, then they can pick up the userland changes.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 8:47 pm

Sorted the chroma-subsampling issue on the background - it was indeed not rounding offset or width to match the subsampling. It does also mean I've had to restrict text heights to even values.

Text colour really is just too scary, particularly when it is doing alpha blended blits rather than over a nice filled colour. I could spend a long time on it and still not get it right. It will stay on my list, but not very far up.

I'll throw those patches at Dom, and he should release them sometime soonish.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ethanol100
Posts: 540
Joined: Wed Oct 02, 2013 12:28 pm

Re: Annotate, any hope for future changes?

Wed Feb 25, 2015 9:27 pm

6by9 wrote:Sorted the chroma-subsampling issue on the background - it was indeed not rounding offset or width to match the subsampling. It does also mean I've had to restrict text heights to even values.

Text colour really is just too scary, particularly when it is doing alpha blended blits rather than over a nice filled colour. I could spend a long time on it and still not get it right. It will stay on my list, but not very far up.

I'll throw those patches at Dom, and he should release them sometime soonish.
Thanks for looking at the subsampling!
The text colour is really not a big issue. I think black text on white background and white text on black background will be the best readable solutions (or white or black text without background).
The text annotations are now very useful and there are endless possibilities to add to userland (read some temperature values or something, add gps coordinates to video...).

Now to other annotations, image/vector graphics overlays would be nice 8-)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 7:38 am

ethanol100 wrote:Now to other annotations, image/vector graphics overlays would be nice 8-)
It has been on the list for ages to add a new component that allows overlay of an image buffer on to a video stream, but it just hasn't happened as yet :( May be at some point....
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 4:31 pm

ethanol100 wrote: The text colour is really not a big issue. I think black text on white background and white text on black background will be the best readable solutions (or white or black text without background).
The text annotations are now very useful and there are endless possibilities to add to userland (read some temperature values or something, add gps coordinates to video...).
Aye! I can agree with that, with size and the ability to invert, that should be adequate!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 5:29 pm

Dom has done his magic, so rpi-update should get all the new goodness.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 7:25 pm

6by9 wrote:Dom has done his magic, so rpi-update should get all the new goodness.
It is magic, and sparkly too, just look at this!

http://youtu.be/wcR0Rx0EQMg

LOL

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 7:41 pm

rahlquist wrote:It is magic, and sparkly too, just look at this!

http://youtu.be/wcR0Rx0EQMg

LOL
What have you done there? Please tell me that the changing in text size is intentional? Or if that is as you are capturing JPEGs, then I think I know what is wrong.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 7:45 pm

6by9 wrote: What have you done there? Please tell me that the changing in text size is intentional? Or if that is as you are capturing JPEGs, then I think I know what is wrong.
Using http://www.raspberrypi.org/forums/viewt ... 43&t=63276 which uses Raspimjpeg here http://www.raspberrypi.org/forums/viewt ... 43&t=61771

Doubt it your code at this point. It is probably Raspimjpeg needing to be brought up to date.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Thu Feb 26, 2015 7:49 pm

rahlquist wrote:
6by9 wrote: What have you done there? Please tell me that the changing in text size is intentional? Or if that is as you are capturing JPEGs, then I think I know what is wrong.
Using http://www.raspberrypi.org/forums/viewt ... 43&t=63276 which uses Raspimjpeg here http://www.raspberrypi.org/forums/viewt ... 43&t=61771

Doubt it your code at this point. It is probably Raspimjpeg needing to be brought up to date.
I'll check with Raspistill whether the snapshot image that comes with the still capture gets the correct sized text. I'm suspecting that the video path is being given the new font size, but the stills path isn't. It didn't matter before where it was always the same height text.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Fri Feb 27, 2015 10:22 am

6by9 wrote:I'll check with Raspistill whether the snapshot image that comes with the still capture gets the correct sized text. I'm suspecting that the video path is being given the new font size, but the stills path isn't. It didn't matter before where it was always the same height text.
Meh, raspistill ends up with no annotation on the snapshot (sent to the display and resized for thumbnail), and indeed it has the default settings on the JPEG annotation.

A quick look at the code and I can see that it doesn't attempt to process the snapshot. I'm not quite so sure why it hasn't passed on the settings to the capture. More things to look at....
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ethanol100
Posts: 540
Joined: Wed Oct 02, 2013 12:28 pm

Re: Annotate, any hope for future changes?

Fri Feb 27, 2015 10:38 am

6by9 wrote: Meh, raspistill ends up with no annotation on the snapshot (sent to the display and resized for thumbnail), and indeed it has the default settings on the JPEG annotation.

A quick look at the code and I can see that it doesn't attempt to process the snapshot. I'm not quite so sure why it hasn't passed on the settings to the capture. More things to look at....
Strange, I have mainly tested raspistill and for me it gives the expected result?!
What exactly does not work?

If I use your userland and run:

Code: Select all

~/6by9/bin/raspistill -a "test123\n" -a 1037 -ae 16,0x00,0x8080ff -o small.jpg
~/6by9/bin/raspistill -a "test123\n" -a 1037 -ae 60,0x00,0x8080ff -o large.jpg
I get the right size:
small.jpg
small.jpg (29.53 KiB) Viewed 1907 times
large.jpg
large.jpg (35.08 KiB) Viewed 1906 times
It will not have the same size as the preview, due to the different sensor modes.

I think I got you wrong, you are talking about the displayed "capture" on the preview and not the final image?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Fri Feb 27, 2015 11:27 am

ethanol100 wrote:I think I got you wrong, you are talking about the displayed "capture" on the preview and not the final image?
Yup, that's what I'm looking at.
As I said, that also should get resized for the thumbnail in the JPEG as well, so that is likely to be missing the overlay. I ran out of time to check.
I was doing something like

Code: Select all

raspistill -ae 64,0x00,0x8080ff "Wibble gibber\nThingy widget" -a 1025 -t 20000 -tl 2000 -o "output%d.jpg"
and as each capture was run I was seeing the annotation disappear from the screen (not applied to the snapshot).
Looking at my captures I thought I saw that they also had white text on black too, but I could be wrong seeing as yours is apparently correct and I can't see an issue from a quick look at the code.

Minor bug fix to raspicam required for the annotate handling. -a 1025 -a "Text" resets the options, as line 661 of RaspiCamControl.c does

Code: Select all

 params->enable_annotate = ANNOTATE_USER_TEXT;
when it finds a text string. |= would be better than =.
Ho hum.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ethanol100
Posts: 540
Joined: Wed Oct 02, 2013 12:28 pm

Re: Annotate, any hope for future changes?

Fri Feb 27, 2015 12:02 pm

6by9 wrote:As I said, that also should get resized for the thumbnail in the JPEG as well, so that is likely to be missing the overlay. I ran out of time to check.
You mentioned that the jpeg thumbnail and preview will miss the annotation before: http://www.raspberrypi.org/forums/viewt ... 54#p594354
I was assuming, that this is the intended behaviour. As you said, the font size will not be the same for the preview and the capture unless we are forcing the full sensor mode, and will then get something similar to the video posted by rahlquist.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Fri Feb 27, 2015 1:13 pm

ethanol100 wrote:
6by9 wrote:As I said, that also should get resized for the thumbnail in the JPEG as well, so that is likely to be missing the overlay. I ran out of time to check.
You mentioned that the jpeg thumbnail and preview will miss the annotation before: http://www.raspberrypi.org/forums/viewt ... 54#p594354
I was assuming, that this is the intended behaviour. As you said, the font size will not be the same for the preview and the capture unless we are forcing the full sensor mode, and will then get something similar to the video posted by rahlquist.
I hadn't remembered that I'd said that before - a lot has happened since August! Fixing the stage to write on the snapshot (display/thumbnail) image should be fairly straight forward and worth doing.
You'll only get the matching text size if preview and capture resolutions are the same - sensor mode is something different, though the -fp flag in raspicam does confuse the two. Making compensation there is one I'm not going to look at - too many ways for it to go wrong.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jsh121988
Posts: 11
Joined: Tue Feb 24, 2015 3:30 pm

Re: Annotate, any hope for future changes?

Sun Mar 01, 2015 10:38 pm

6by9 wrote: What have you done there? Please tell me that the changing in text size is intentional? Or if that is as you are capturing JPEGs, then I think I know what is wrong.
It's funny you should mention that. I am capturing via python picamera. When I start recording, then capture a jpeg, it blows up the font size and covers the top half of the video. Like alternating between size 14 to size 60 until the capture is complete.

I realize the python module doesn't support v3 yet, but this started happening after I updated.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Thu Mar 05, 2015 7:09 pm

Dom's just pushed out my fix to apply the annotation to the snapshot (used for display and thumbnail) image - sudo rpi-update to get it. It works for me fine in raspistill with the annotation remaining on the screen for all images (I tested with timelapse mode).
If people see oddball changes of size then please provide a simple test case for me to see what is going on.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: Annotate, any hope for future changes?

Sat Mar 07, 2015 12:50 am

Thanks 6by9.

Did the usual;
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update

Rebooted and when raspimjpeg restarted it will still jumping. I have found that if I take a still image using their UI it will stop the jumping. I may need to see if silvan will update raspimjpeg or if he is done with the project if I can fork it.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5805
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Annotate, any hope for future changes?

Sat Mar 07, 2015 7:38 am

rahlquist wrote:Rebooted and when raspimjpeg restarted it will still jumping. I have found that if I take a still image using their UI it will stop the jumping. I may need to see if silvan will update raspimjpeg or if he is done with the project if I can fork it.
SIMPLE test case! I'm not going to spend time installing, fighting to get to work, and then analysing a big app like Raspimjpeg to work out what they're doing.
The only thing I can think they are doing is changing resolution (and hence text size due to fixed point font) between frames. Not going to be able to fix that, and it's a daft thing to do from a performance perspective.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: Annotate, any hope for future changes?

Sat Mar 07, 2015 3:34 pm

6by9 wrote: SIMPLE test case! I'm not going to spend time installing, fighting to get to work, and then analysing a big app like Raspimjpeg to work out what they're doing.
Oh come now, surely this would be easy, and next, after that, you can figure out why windows can be such a pile at times!</sarcasm>

No need to get your knickers in a knot. I purposely didn't give a test case at this point, just was sharing my observation. I figured it was highly likely not your code at issue. I dropped a message over in the raspimjpeg thread last night to see if Silvan wants to update, if i don't hear anything from him over the next few weeks, then I will either try it myself or just pass on the whole thing.

To agree with what you are saying about it likely being something related to sizing, when I record an image I have to time it to coincide with the small text showing. If I hit record image while the large text is showing it continues to oscillate. This is partly why I figured it wasn't your issue.

jsh121988
Posts: 11
Joined: Tue Feb 24, 2015 3:30 pm

Re: Annotate, any hope for future changes?

Mon Mar 09, 2015 12:36 am

Just wanted to let you know it is still occurring with the latest fw. I am using picamera, recording video to splitter port 1, and capturing with use_video_port. Don't worry about it though. I am just going to wait for picamera to support V3, then test it again. For now i have disabled the picture capture in my script.

Return to “Camera board”