Custom frame transform?

Discussions on extending SharpCap using the built in Python scripting functionality
furrysocks2
Posts: 14
Joined: Wed Jan 03, 2018 1:28 pm

Re: Custom frame transform?

Post by furrysocks2 » Tue Sep 25, 2018 11:22 am

Got something working now from Python->C++... it's not fast, but yet to work out why. [Edit - it was a debug build - release is somewhat faster]

Code: Select all

dll=ctypes.CDLL(dllfile)

def handler( sender, eventArgs):

	frame          = eventArgs.Frame
	info           = frame.Info
	bufsize        = int(frame.BufferSize)
	
	lease          = frame.GetBufferLease()
	frameData_addr = lease.Buffer.ToInt64()
	frameData_ptr  = ctypes.cast(frameData_addr, ctypes.POINTER(ctypes.c_ubyte))

	dll.do_foo(frameData_ptr, info.Width, info.Height, bufsize);
	
	lease.Dispose()

furrysocks2
Posts: 14
Joined: Wed Jan 03, 2018 1:28 pm

Re: Custom frame transform?

Post by furrysocks2 » Tue Sep 25, 2018 8:34 pm

I added a button to the toolbar to open a dialog and allow me to vary the parameters to the C++ routine. Currently only MONO8, but I'll see about MONO16 and perhaps RGB.

The approach you suggested certainly works. I don't know to what extent ADPB suits astro images, but I've something to play with now.

Thanks for your help!
sharpcap adpb.gif
sharpcap adpb.gif (118.15 KiB) Viewed 868 times

User avatar
admin
Site Admin
Posts: 3094
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Custom frame transform?

Post by admin » Tue Sep 25, 2018 9:14 pm

Awesome! That's really cool.

How much processing time does it take per frame?

cheers,

Robin

furrysocks2
Posts: 14
Joined: Wed Jan 03, 2018 1:28 pm

Re: Custom frame transform?

Post by furrysocks2 » Tue Sep 25, 2018 9:54 pm

Thanks!

I've instrumented the C++ and return the execution time to Python - approximately 160ms per frame (1280x960 MONO8).

furrysocks2
Posts: 14
Joined: Wed Jan 03, 2018 1:28 pm

Re: Custom frame transform?

Post by furrysocks2 » Tue Sep 25, 2018 10:05 pm

admin wrote:
Sun Sep 23, 2018 7:53 pm
events on the Camera class (FrameCaptured, BeforeFrameDisplay)
I'm assuming dark subtraction and other things happen between these two events?

User avatar
admin
Site Admin
Posts: 3094
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: Custom frame transform?

Post by admin » Wed Sep 26, 2018 5:37 pm

Hi,

yes, the FrameCaptured event is pretty much the first thing that happens after the data comes off the camera - nothing will have touched the image data at this point.

BeforeFrameDisplay is the last thing before showing on screen - at this point dark/flat processing, frame transforms have happened. The frame is still at it's original bit depth and may not have been debayered by this point (some transforms debayer the frame earlier than this). The frame has also already been written to file if capturing at this point.

cheers,

Robin

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest