Brand new edge overlay. Please test. - page 3 - General Discussion and Assistance - CHDK Forum

Brand new edge overlay. Please test.

  • 36 Replies
  • 23359 Views
*

Offline f_m_b

  • **
  • 71
Re: Brand new edge overlay. Please test.
« Reply #20 on: 24 / August / 2010, 16:03:29 »
Advertisements
@ultimA:
Tested with sx20 (1.02b)
- the patch is compileable and runable.
- not the complete picture is analyzed or shown. The left and rigth side are ok. At the upper side there is a lack of 3mm ,lower side of 8mm, left side of 2mm and right side of 1mm without edge information. This is no scaling problem, because the edge information maches to the picture on screen.

Macro:
- with high-diopter +5 close-up filter, 200mm zoom and
  - a threshold of 100 i can see realy good the changing of focus distance (while changing slowly the distance of the sx20) of the keys of my pocket calculator. It is white and the numbers are black.
  - a foto of mine (id-card) doesn't work so good, because there are too many high contrasted zones; so in desfocused state the contrast for Example from hair to background is even higher then the focused part on the eyes. I tried with various thresholds... With the right threshold and some practice/experience it can be helpfull.

I have to study more about the options Filter edges, Panorama Mode and the load and save stuff...
To be continued tomorrow...


Save/Load:
I don't know what can i do with this feature... but it's work.
 
Panorama:
I think the internal panorama mode of the sx20 isn't too bad. But it works although with edge detection.

Non Panorama:
Sometimes after "pressing shutter" the picture freezes and somtimes after (look at bugs) showing non init memory the mode is "continous" and not freezed.

Some questions:
- Why "Filter edges" is an option and is not used every time?
- Can i freeze without shooting a picture?
- After using panorama mode the last picture is freezed. How can i release this mode back to continous mode? Deactivate panorama mode doesn't help. Free internal Memory helps... but i don't know if that is a feature?

Some bugs or missunderstandings:
- I cant read messages from "Save Edge Overlay" and "Free internal Memory" because Edge overlay popup hide them.
- In panorama mode the picture freezes while pressing shutter in "ALT" mode.
- After freezing (pressing shutter without pano mode) sometimes the none init memory is shown for 1/2 second (horizontal bars all over the display).
- I can't reproduce the following bug. I have seen rare times that a part of the edge detection is not cleaned while moving the camera. I try to reproduce it.

Some ideas:
- It could be usefull to change the threshold with jogwheel while in edge detection mode. (Attention: jogwheel is although used with Ev changes)
- Show magnified edge detection with use of "focus lense" (AF Point Zoom = on or MF-Point Zoom = on)

Tomorrow... - oh no - :o later i take a look at the sources. :)

!!! Nice work !!!
« Last Edit: 24 / August / 2010, 18:41:22 by f_m_b »
Greetings Frank
SX20 (1.02b)

*

Offline ultimA

  • ***
  • 137
Re: Brand new edge overlay. Please test.
« Reply #21 on: 24 / August / 2010, 23:01:12 »
Okay, a new update to the diff. To produce thinner lines I took another look at the simpler Roberts Cross operator. I experimented a lot with it and it turns out you can get almost the same results with Cross as with Sobel, if you tune the threshold. Eg. Sobel 40 corresponds to Cross 10 approximately. Of course this is not the only difference as the Sobel is better at detecting edges in general (but also more sensitive to noise), but with the right settings the differences are hardly noticable. But even though Sobel requires more performance, I'm choosing Sobel, because the threshold value can be used in a much larger range in that case. Eg. you see that a 40 of Sobel is appr. a 10 in Cross, so the user would not have too much room to make Cross even more sensitive. Instead, I redefined the default value of Sobel to 60 and I have completely rewritten the filtering method.

The newest patch now does prefiltering on the viewport data instead of postfiltering the edge overlay results. This results in a much nicer image, as you will see. Of course, normally this would have needed a copy of the viewport, for which we do not have enough memory. So I just malloc space for 3 lines of the viewport in which I store three lines of filtered viewport data, and I slide that window vertically over the viewport as I am simultanously calculating the edge overlay from that buffer. So this is how I do filtering on the viewport while still keeping the memory requirement very low.

BTW, for NewbieToobie, here is an updated S3 build: http://www.mediafire.com/?dg065o233xcsta2
I hope this is better for macrophotography, since I am starting to run out of options that can be implemented efficiently with so much limited resources. BTW, I noticed that the S3 is has a DIGIC II, which is two generations older than the DIGI IV that I am testing on. So I am interested in the performance. Do you find the speed of the edge overlay usable? That would mean it is acceptable for older cameras too.

@neszt: I repositioned the text messages. They are not occupied by the menu anymore and you can read them if they are displayed.

@f_m_b:

not the complete picture is analyzed or shown
This is by design. Up and down at the edges of the screen are left unpainted to occupy less OSD, left and right are safety margins that are needed by the filtering. What is NOT by deisgn is the assymetry. I do not understand why and how the  left is larger than at right, or why the bottom is larger than the top. I suspect the latter is because the height of the viewport defined in firmware-sub lib.c is false (see sx20 porting thread), but I'm not sure. - Found cause.

Panorama:
I think the internal panorama mode of the sx20 isn't too bad. But it works although with edge detection.
Yes but not all cameras have a panorama mode. And even the SX20's internal panorama only lets you create horizontal panoramas. With edge overlay you can also do multi-row/vertical panoramas.

Why "Filter edges" is an option and is not used every time?
Because it makes edge overlay much slower and might also remove useful edges, you for these reasons someone might not want filtering. It also makes the OSD a bit more sluggish, and is not needed anyway under good lighting conditions.

Can i freeze without shooting a picture?
Not currently. Do you think this would be useful? How/with what button?

After using panorama mode the last picture is freezed. How can i release this mode back to continous mode?
Deactivate panorama and take a shot or free memory. This is not a feature, but a usability issue. I will try to solve that but currently the only way I see would considerably complicate code logic.

I cant read messages from ...
Fixed in current patch.

In panorama mode the picture freezes while pressing shutter in "ALT" mode
I'm not sure I understand. Seems fine for me. Could you please elaborate?

After freezing (pressing shutter without pano mode) sometimes the none init memory is shown for 1/2 second (horizontal bars all over the display).
Again, I'm not sure what you are seeing. I think I have seen the same thing, and I realized it was because I was pointing the camera at my monitor. It is the effect of undersampling the refresh rate of the monitor's scanline, which the algorithm detects as a horizontal edge. If you point the camera away from the monitor, it doesn't show up. Or do you have something different?

I can't reproduce the following bug. I have seen rare times that a part of the edge detection is not cleaned while moving the camera. I try to reproduce it.
Again, not clear. Why should the edge detection be cleared just from moving the camera?

It could be usefull to change the threshold with jogwheel while in edge detection mode.
Very nice idea. I'll take a look into it.

Show magnified edge detection with use of "focus lense" (AF Point Zoom = on or MF-Point Zoom = on)
Nice idea and I already thought about it and tried whether it works previously. Even though the center of screen is displayed magnified, the liveview buffer still contains the unmagnified image. So I do not know how to do this currently, as I cannot access the magnified view. But it would definitely be nice.
« Last Edit: 26 / August / 2010, 22:40:34 by ultimA »

Re: Brand new edge overlay. Please test.
« Reply #22 on: 25 / August / 2010, 00:10:08 »
Wow, that's pretty cool. With a threshold setting of 100 to 200 (somewhere around 170 being optimum) it pretty much works as I had hoped. Neat! There are times where a higher-contrasting subject that is out of the focus zone will grab the edge-detection and display the highlighting, but for the most part it actually works. Neat! THANKS!

As for the speed on Digic II, I can count out-loud a faster 1,001, 1,002, etc. to match each refresh (a little faster than 1/sec). It's not fast, but hey, it works! I can see how in important macro-photography situations where getting the most important parts of your whole subject in focus, vs. just trying to focus on a single area at a time, this would be very beneficial. Lock the camera into manual focus, then move the camera toward or away from your subject until the important parts are highlighted by the edge-detection.

Nice work! :)


*

Offline f_m_b

  • **
  • 71
Re: Brand new edge overlay. Please test.
« Reply #23 on: 25 / August / 2010, 08:43:55 »
Yes but not all cameras have a panorama mode. And even the SX20's internal panorama only lets you create horizontal panoramas. With edge overlay you can also do multi-row/vertical panoramas.
With sx20 you can make horizontal, vertical and 2 hor. x 2 vert.  panoramas. But you are right, not everybody has this feature.

..Can i freeze without shooting a picture?...
Not currently. Do you think this would be useful? How/with what button?
I have no idea. I will think about it.

...I cant read messages from ...
Fixed in current patch.
ok. passed test.

...In panorama mode the picture freezes while pressing shutter in "ALT" mode...
I'm not sure I understand. Seems fine for me. Could you please elaborate?
Let me see if i understand the making of panos:You shoot the first foto, edges are freezed. ok. You change to "alt" to move the edges and then you have to go to normal foto mode without "alt". You match the next foto to the moved edges and shoot the next foto... and so on.
Once i forgot changing from "alt" to "non alt" and press shutter full, i know it's my fault... i had no script loaded, so i started only the default script, but the edges of the last foto are lost because the new edges are set without shooting a foto. I corrected my fault by deactivating "alt", but i can't match the next pano foto and have to start from the beginning.
I think with activated "alt" there should be no freezing edges.

Another idea to pano: Give Pano not only the option on/off.
You can realize the pano modes on sx20, i like it and it's realy comfortable.
Possible options for pano:
- horizontal right
- horizontal left
- vertical down
- vertical up
- free mode [default]

And another option for the overlap:
- 20% [default]

free mode is like now.
With the other modes you can move the edges (after shooting) automaticly and show only the part of the given overlap.


...After freezing (pressing shutter without pano mode) sometimes the none init memory is shown for 1/2 second (horizontal bars all over the display)...
Again, I'm not sure what you are seeing. I think I have seen the same thing, and I realized it was because I was pointing the camera at my monitor. It is the effect of undersampling the refresh rate of the monitor's scanline, which the algorithm detects as a horizontal edge. If you point the camera away from the monitor, it doesn't show up. Or do you have something different?
No i don't think so, for me it looks like uninitialized memory. Look at the two fotos at the link.
This is a foto from the front side of my keyboard. One with correct edge detection and the other with the error.
correct edges
not correct edges
*Sorry the quality is realy bad, but i shoot this fotos with another camera.
**Please ignore the discription of linked Files.

In play mode i saw another similar effect. Look at your shooten fotos step by step, and then you see for a short moment parts of the previous foto.

On question about the option "Enable in Play". It shows no effect. I see only edges in play mode when "Always show" is active.

...I can't reproduce the following bug. I have seen rare times that a part of the edge detection is not cleaned while moving the camera. I try to reproduce it...
Again, not clear. Why should the edge detection be cleared just from moving the camera?
For example i was looking in macro mode on my foto of the id-card. I saw clearly the edge of my hair to the background. When i move the camera the edge follows. ok.
But sometimes i saw the old edge (or more of them) and the new one. One time i had three of this edges in a distance of 2-3mm.

... Show magnified edge detection with use of "focus lense" (AF Point Zoom = on or MF-Point Zoom = on)...
Nice idea and I already thought about it and tried whether it works previously. Even though the center of screen is displayed magnified, the liveview buffer still contains the unmagnified image. So I do not know how to do this currently, as I cannot access the magnified view. But it would definitely be nice.
Maybe someone knows how does it works. :)

A last question:
How should work "Panorma Mode = off"?
« Last Edit: 25 / August / 2010, 08:49:36 by f_m_b »
Greetings Frank
SX20 (1.02b)

*

Offline f_m_b

  • **
  • 71
Re: Brand new edge overlay. Please test.
« Reply #24 on: 25 / August / 2010, 17:34:50 »
Another idea to pano: Give Pano not only the option on/off.
You can realize the pano modes on sx20, i like it and it's realy comfortable.
Possible options for pano:
- horizontal right
- horizontal left
- vertical down
- vertical up
- free mode [default]

And another option for the overlap:
- 20% [default]

I realised this feature in the following patch. If you think it's ok you can use it. :)
new-edge-v4a.diff (Different Pano Modes)
*The patch is based on revision 926 and need new-edge-v4.diff.
**This is not a full patch. Includes only the changed files for "Different Pano Modes".

...I have corrected a double numbering in german.lng
« Last Edit: 25 / August / 2010, 18:11:59 by f_m_b »
Greetings Frank
SX20 (1.02b)

*

Offline ultimA

  • ***
  • 137
Re: Brand new edge overlay. Please test.
« Reply #25 on: 25 / August / 2010, 21:20:52 »
With sx20 you can make horizontal, vertical and 2 hor. x 2 vert.  panoramas. But you are right, not everybody has this feature.
WTF really!!! Thx, I did not know of this feature, but now I've found it.

...In panorama mode the picture freezes while pressing shutter in "ALT" mode...
Fair. Accepted.

Another idea to pano: Give Pano not only the option on/off.
Accepted. (Implemented using parts of your patch). But now again there is no place to display messages.

uninitialized memory
I cannot reproduce. Since you say it is only visible for 1/2 sec, this less important.

On question about the option "Enable in Play". It shows no effect. I see only edges in play mode when "Always show" is active.
This makes sense. Since if you press the shutter half, it would switch into rec-mode. This is expected behavior. However,  play mode had another bug (it was always on), which is now corrected.

A last question:
How should work "Panorma Mode = off"?
When panorama=off, then every picture taken switches between live mode and freeze mode. BTW, I have made fixes to exit panorama mode easily. It is now enough if it is turned off.

The diff is not uploaded yet with the fixes I've made. Some time later.

*

Offline ultimA

  • ***
  • 137
Re: Brand new edge overlay. Please test.
« Reply #26 on: 25 / August / 2010, 21:55:36 »
...

That's nice to hear. I guess the potential userbase of CHDK just got bigger :D. That also means that after the patch is polished (not long anymore), it can be commited.

*

Offline ultimA

  • ***
  • 137
Re: Brand new edge overlay. Please test.
« Reply #27 on: 26 / August / 2010, 20:13:59 »
A new version (v5) of the patch is uploaded, it can be found in the opening post. The changes are also described there.

Initially I also implemented changing the threshold using the jogdial, but I removed it in the in the end. It was a cool feature, but the global state of jogdial screws up things if many functions (or tasks) try to use it. Basically, if the user rotates the dial, only the first call after the rotation will be able to sense that. So depending on the configuration options, the functioning of the dial was a 50% hit-and-miss. This could be partially solved by reworking all the code the use the jogdial across all cameras and across CHDK (implementing a per-function state), but the best case reachable that way is that multiple settings would have changed at the same time when rotating the button. This would have been confusing to the user. I am also pretty sure that not all cameras have a jogdial, so I wouldn't rely on this feature too much. So, since it is basically impossible to get this working consistently in many different scenarios, (even with the same model of cameras), I left it out. It is really a shame because it was a nice feature, but I do think it would have had more disadvantages than advantages.

Anyway, this is hopefully the final patch version. Unless some serious bug is found, I'm going to try to commit it to the trunk. So everyone, please test it.
« Last Edit: 26 / August / 2010, 20:16:42 by ultimA »

*

Offline f_m_b

  • **
  • 71
Re: Brand new edge overlay. Please test.
« Reply #28 on: 27 / August / 2010, 04:45:13 »
...
I have short-tested patchV5.

- compiles and can be start. ok.
- "Enable in Play". ok
- "Panorama Mode" off. ok toggles between frozen and live.
- "Panorama Mode" on. ok.
  - I would use the same pano-mode-order like sx20 "Right", "Left", "Up", "Down", "Free".
  - Default overlap by sx20 in panomode is 35%. (sorry about 25% in my patch)
- no new Edges in "ALT"-Mode. ok.
- Load/Save. Load+Set Zoom. ok

The only two yet known errors i found are:
 - pano off: From frozen mode to live mode (pressing shutter) there are for 0.5 second not valid edges shown on the upper half of display.
 -play mode: switching from one foto to the next.
   The lower half side of the edges of the previous foto are shown for 0.5 second in the upper half of the edges of the actual foto.
In both of them only the upper half of display is "corrupt"!?

In code i found a comment which doesn't match... is free mode not "top to bottom"
Code: [Select]
set_offset_from_overlap()
...
case 5: //"v"  pano from top to bottom
Greetings Frank
SX20 (1.02b)

*

Offline ultimA

  • ***
  • 137
Re: Brand new edge overlay. Please test.
« Reply #29 on: 27 / August / 2010, 13:41:20 »
I have short-tested patchV5.
As always, I cannot thank you enough times. You are really helpful.

  - I would use the same pano-mode-order like sx20 "Right", "Left", "Up", "Down", "Free".
My consideration was that most users use (I think) the Right and Down directions. So the current way they need the least clicks to get there. By coincidence, you can also consider the order in my patch to be clockwise, if it is more logical that way.

  - Default overlap by sx20 in panomode is 35%. (sorry about 25% in my patch)
I actually wanted to make it smaller and I set it to 20% the first time I ran with the patch. Then I saw that 20% is too small so I increased it back to 25%, which I find good compromise. I will try 30%. I also think I will set the default threshold down to 50.

- pano off: From frozen mode to live mode (pressing shutter) there are for 0.5 second not valid edges shown on the upper half of display.
 -play mode: switching from one foto to the next.
   The lower half side of the edges of the previous foto are shown for 0.5 second in the upper half of the edges of the actual foto.
I can't seem to reproduce it. But since the corruptions are only visible for 1/2 sec, this is a minor issue. I will try to correct them if I manage to reproduce somehow. Currently, I do not see any place in the code that could be responsible for such things. In any case, this is not a blocker and I consider the patch final (with the minor adjustments described in this post)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal