edge overlay - General Discussion and Assistance - CHDK Forum  

edge overlay

  • 41 Replies
  • 19462 Views
edge overlay
« on: 27 / April / 2008, 02:19:39 »
Advertisements
Hi,

I have written some code to create an edge image of the previous shot and overlay it on the screen.  The code is just something quick to test out the feasibility.  Hopefully something like this will be useful when creating a stereo pair of images.
I have used the Zebra mode configuration to scale the threshold (you should not have zebra mode enabled when running this.)  Different Zebra modes give different edge thresholds.
I have also added a delay so that the screen is updated more slowly.

It appears to work great. 
I am using allbest build 50.  Paste the code into main.c after the line #include "motion_detector.h".

Then add the line
edge_overlay();

after the
histogram_process();
line.

CODE REMOVED>  New version is here:edge overlay
« Last Edit: 08 / May / 2008, 12:00:32 by hiker_jon »

Re: edge overlay
« Reply #1 on: 27 / April / 2008, 05:44:53 »
Hi,

I have written some code to create an edge image of the previous shot and overlay it on the screen.  The code is just something quick to test out the feasibility.  Hopefully something like this will be useful when creating a stereo pair of images.

Great !

I guess it will have to be in SDM 1.6x (or even 1.70) as I have just released 1.60.

This looks very promising, will need a bit of development.

1. Try to reduce the amount of noise so we just get clean outlines in most situations.

2. Works fine on half-press and overlays live screen with edge-processed viewport image.
    On full-press, does not work, image overlaid with wide horizontal bands.

Edge-detection and noise-removal is quite an extensive and well-documented topic.
Presumably, there are ImageJ examples of such processing.





David
« Last Edit: 27 / April / 2008, 09:24:38 by Microfunguy »

Re: edge overlay
« Reply #2 on: 27 / April / 2008, 11:06:11 »
1. Try to reduce the amount of noise so we just get clean outlines in most situations.

2. Works fine on half-press and overlays live screen with edge-processed viewport image.
    On full-press, does not work, image overlaid with wide horizontal bands.

1: Try increasing thresh. May need different thresh for different cameras or situations.  We should make it into a configurable parameter.
2: What camera do you have?  On my a720is it works fine even when shooting. 

Do you have Zebra mode enabled?  Should be off.

May be timing considerations.  Digic 2 vs 3? 

The calculation could be split up like the histogram calculation.  To test on your camera change the number of lines in the edge calc and overlay display loops.  Say start with something like for(y=100; y<150; y++).
« Last Edit: 27 / April / 2008, 11:48:56 by hiker_jon »

Re: edge overlay
« Reply #3 on: 27 / April / 2008, 11:53:50 »
We should make it into a configurable parameter.

Yes, if there are any shortcuts left (in SDM).


Quote
What camera do you have?

A620 (DIGIC II)

Quote
start with something like for(y=100; y<150; y++).


0 to 150 certainly works.

Need to greatly reduce the refresh-rate for this overlay, cannot read other items on screen.


I will have to study the histogram code.


David


Re: edge overlay
« Reply #4 on: 27 / April / 2008, 13:36:23 »
Looking at the edge overlay indoors, the noise is random points that constantly change position.

Maybe the overlay could be AND'ed with itself (while shutter half-pressed) ten times so that the noise was excluded and only the static edges remained.



David

Re: edge overlay
« Reply #5 on: 27 / April / 2008, 16:34:39 »
Looking at the edge overlay indoors, the noise is random points that constantly change position.

This sounds like a threshold problem, it should be higher for noisy indoor images. 

I have updated the code with a delay for screen updating and the ability to use the Zebra mode as a way to change the threshold.  I think blink1 gives the smallest threshold, subsequent modes will give higher thresholds.  Zebra should be turned off, however.

Re: edge overlay
« Reply #6 on: 27 / April / 2008, 16:42:53 »
I have updated the code

I will try that now.

I have just been researching sobel and canny edge detectors, gaussian smoothing, median filters, etc.

In comparison, your code is remarkably brief and works well.

I do not really understand how it works.


David
« Last Edit: 27 / April / 2008, 16:50:42 by Microfunguy »

Re: edge overlay
« Reply #7 on: 27 / April / 2008, 17:07:19 »
Yes, that is very interesting and useful.

Could you do one more thing ?

Split the calculation into two parts so that it works when I shoot an image with my A620 ?


Thanks.



David


Re: edge overlay
« Reply #8 on: 27 / April / 2008, 18:58:21 »
I have just made the following changes that work really well, you can see the noise dissolve-away as you keep the button pressed :-

static  float thresh = 10.0f;

......

      if (kbd_is_key_pressed(KEY_SHOOT_HALF)) {
                       thresh+= 0.5;
                       if(thresh>50.0) thresh = 10.0f;

......

(int)thresh

*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: edge overlay
« Reply #9 on: 28 / April / 2008, 00:31:51 »
Great stuff! I guess we also have an enhanced pano function,thanks!

 

Related Topics