EOS M3 porting - page 13 - DryOS Development - CHDK Forum supplierdeeply

EOS M3 porting

  • 746 Replies
  • 399718 Views
*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #120 on: 23 / August / 2016, 05:08:45 »
Advertisements
Probably you will need to change the Sobel (calc_edge_overlay) edge detection

I fixed Sobel convolution:
Code: [Select]
        for (x = x_min, xdiv3 = x_min/2; x < x_max; x += 4, xdiv3 += 2)
        { //  1 231  2 3
            // convolve vert (second Y) //  1 234  5 678 >> 1 2  3 4  5 6
            conv1 = *(ptrh1 + x + 1) * ( 1) + // UYVYYY UYVYYY >> UYVY UYVY UYVY
                    *(ptrh1 + x + 5) * (-1) + // 012345 678901 >> 0123 4567 8901

                    *(ptrh2 + x + 1) * ( 2) +
                    *(ptrh2 + x + 5) * (-2) +

                    *(ptrh3 + x + 1) * ( 1) +
                    *(ptrh3 + x + 5) * (-1);
            if  (conv1 < 0)     // abs()
                conv1 = -conv1;

            // convolve vert (first Y of next pixel)
            conv2 = *(ptrh1 + x + 1) * ( 1) +
                    *(ptrh1 + x + 3) * ( 2) +
                    *(ptrh1 + x + 5) * ( 1) +

                    *(ptrh3 + x + 1) * (-1) +
                    *(ptrh3 + x + 3) * (-2) +
                    *(ptrh3 + x + 5) * (-1);
            if  (conv2 < 0)     // abs()
                conv2 = -conv2;

            if (conv1 + conv2 > conf.edge_overlay_thresh)
            {
                bv_set(edgebuf, (y-camera_screen.edge_hmargin)*viewport_width + xdiv3, 1);
            }

            // Do it once again for the next 'pixel'

            // convolve vert (second Y)
            conv1 = *(ptrh1 + x + 7) * ( 1) +
                    *(ptrh1 + x + 11) * (-1) +

                    *(ptrh2 + x + 7) * ( 2) +
                    *(ptrh2 + x + 11) * (-2) +

                    *(ptrh3 + x + 7) * ( 1) +
                    *(ptrh3 + x + 11) * (-1);
            if  (conv1 < 0)     // abs()
                conv1 = -conv1;

            // convolve vert (first Y of next pixel)
            conv2 = *(ptrh1 + x + 7) * ( 1) +
                    *(ptrh1 + x + 9) * ( 2) +
                    *(ptrh1 + x + 11) * ( 1) +

                    *(ptrh3 + x + 7) * (-1) +
                    *(ptrh3 + x + 9) * (-2) +
                    *(ptrh3 + x + 11) * (-1);
            if  (conv2 < 0)     // abs()
                conv2 = -conv2;

            if (conv1 + conv2 > conf.edge_overlay_thresh)
            {
                bv_set(edgebuf, (y-camera_screen.edge_hmargin)*viewport_width + xdiv3+1, 1);
            }
        }   // for x
    }   // for y

Now it looks better:


But I'm not sure about x step: I was thinking it should be 8, but practically I found it as 4.
« Last Edit: 23 / August / 2016, 05:15:57 by Ant »

Re: EOS M3 porting
« Reply #121 on: 23 / August / 2016, 11:29:10 »
That does look better! I'll test on sx60hs when I get a chance.  After thinking a bit, the X step really doesn't need to change since we only care about Y values. So with X step=4, it's slow and you repeat the calc with some of the same pixels. 
Maybe FWIW X step can be 6 (I think this was how it was for non-thumb). Why do we need to change it ; 6 or 12 is well suited to groups of three Y values. 
Did you change the average filter so it will also pick up Digic 6 Y values?
The same comments may apply.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #122 on: 23 / August / 2016, 12:14:51 »
Did you change the average filter so it will also pick up Digic 6 Y values?
Yes. See my revision 23.
But I don't see difference between 4 and 8 step in filter.

Canon's "focus peaking" works much faster, but I did not found where it draws.
« Last Edit: 23 / August / 2016, 12:26:47 by Ant »

Re: EOS M3 porting
« Reply #123 on: 23 / August / 2016, 14:11:18 »
I played with it a bit...seems to work similarly on the SX60HS.  I tried changing xstep and a few other things which I think should work, and I see the drawing of the edgeoverlay moves to the left, as if the scale is wrong, but the calculation is correct. I think this really means that core drawing routines do not fully /correctly support digic 6 pixel coordinates but the actual edge detection is working well and probably 2-3x faster. There are many places in core/gui_draw.c where Digic 6 is not yet supported...and when it is things might need adjustment here.


Re: EOS M3 porting
« Reply #124 on: 23 / August / 2016, 14:33:57 »
I adjusted the scaling so that you can change the xstep to a larger value. Tried to consolidate some of the code.....probably not any better than what you had, but I've attached it so you can understand FWIW.  With xstep 12, it looks a bit strange, with 6 it is fine, with 4 the edge lines get thicker...
Not sure but, the edges seem to accumulate if you move the camera, until you half press the shoot key again.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #125 on: 23 / August / 2016, 14:39:31 »
I think this really means that core drawing routines do not fully /correctly support digic 6 pixel coordinates
But motion detection draws grid correctly without any changes...

Re: EOS M3 porting
« Reply #126 on: 23 / August / 2016, 14:58:31 »
Quote
But motion detection draws grid correctly without any changes...
You're correct...the missing stuff in gui_draw.c seems to be mainly related to "get" pixel stuff. So changing Xstep just required a different step in xdiv3 so it would increment to the right value in less steps.
I should have tried X step = 8.  It might be best. 

« Last Edit: 23 / August / 2016, 17:02:30 by 62ndidiot »

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #127 on: 26 / August / 2016, 09:45:27 »
I implemented filewrite.c based on SX60 and G7X ports.
But there are some problems:
1. When I shoot in RAW mode, images recieved via ptpCHDK have *.jpg etension instead *.cr2
2. When I shoot in RAW+JPEG mode *.jpg file still still saved in camera.
3. When I switched camera to Play mode I found Undefined Images with numbers corresponding to already transferred images

Is it normal?


*

Offline reyalp

  • ******
  • 14086
Re: EOS M3 porting
« Reply #128 on: 26 / August / 2016, 16:37:20 »
I implemented filewrite.c based on SX60 and G7X ports.
But there are some problems:
1. When I shoot in RAW mode, images recieved via ptpCHDK have *.jpg etension instead *.cr2
2. When I shoot in RAW+JPEG mode *.jpg file still still saved in camera.
3. When I switched camera to Play mode I found Undefined Images with numbers corresponding to already transferred images

Is it normal?
Yes, all are normal. The remote shoot code currently isn't aware of canon raw because neither srsa nor I had cameras with native raw support when we implemented it. I'd like to add support at some point, but if you want to remote shoot raw+jpeg, you can use CHDK raw and disable canon raw.

The undefined image is also normal, since some parts of the camera OS still think a file was saved. On some cameras switching to play crashes.
Don't forget what the H stands for.

*

Offline Ant

  • *****
  • 509
Re: EOS M3 porting
« Reply #129 on: 26 / August / 2016, 16:51:52 »
you can use CHDK raw and disable canon raw.
Is DNG RAW shooting correctly implemented in your G7X port?

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal