Auto Adjustment of LiveStack Histogram (without Manual Intervention)

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
RichSky42
Posts: 3
Joined: Tue Oct 20, 2020 12:44 pm

Auto Adjustment of LiveStack Histogram (without Manual Intervention)

#1

Post by RichSky42 »

I have a Automated Target/Imaging sequencer and I'm can call and capture LIveStack Image Sets. I can save the Raw Fits files for later detailed reduction/processing, and I can get a LiveStack Colour (.png) image for initial quick look / automated posting on realtime web page etc. My problem is I can't get any sort of decent LiveStack Colour Image unless I manually intervene to click an AutoColour Balance button (I normally use colour balance from histogram peaks) and then click Auto-Stretch button. This prevents my process from being fully-automated in the way that I want. I have to either be continuously in attendance to click the auto buttons at the appropriate moment, or accept a rotten Live Stack picture (you know one with a green, red or blue background, rather than a nice black background).

I don't think there is a way of achieving this at present. I've seen something in the scripting forum where one can read, but ?not set , Black Level, Mid Level and White Levels. But even if one could set them then it would be unlikely to select right value and do it would be in a way that would be as good as or anywhere as easy to use as SharpCap's own auto-abilities - it would be a rather bespoke solution to a relatively general problem.

So unless I've missed something I would like to propose the following new SharpCap feature :

a) SharpCap to have a setting to turn-on 'automatic colour-balance and stretch' so that auto-colour & stretch is automatically applied for each and every Live Stack run (obviously with setting to off for those who don't want it and wish to have full manual control including manual use of AutoColour Balance/AutoStretch as per current)

and/or

b) Have SharpCap.LiveStack methods available that can be called from Python script to i) apply AutoColour balance to Histogram , ii) apply AutoStretch to Histogram.

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

Re: Auto Adjustment of LiveStack Histogram (without Manual Intervention)

#2

Post by admin »

Hi David,

You're right that this is currently something that cannot be achieved with scripting – you can recover the current values of the stretch and colour balance parameters and even change the values, but they will not take effect. I will have to have a look to see how easy it is to make the values and the automatic adjustment available to scripting – I suspect it might be a bit tricky :-(

As a horrible hack, you may be able to find code or executables that will send simulated mouse clicks – since you're probably always running full-screen, the location of the auto stretch buttons should be constant, so perhaps you could use this approach to 'automate' the implication of the auto stretch!

Cheers, Robin
RichSky42
Posts: 3
Joined: Tue Oct 20, 2020 12:44 pm

Re: Auto Adjustment of LiveStack Histogram (without Manual Intervention)

#3

Post by RichSky42 »

Robin

A hack of the type you mentioned could be programmed and could work in theory. However there are some barriers to making it a sufficient robust solution. I don't normally work with SharpCap maximised as its only one of several applications that I run during a session. That's not really a showstopper as one could program mouse clicks with an offset relative to the Top X Y of the main SharpCap window. What is an issue is that the positions of the buttons would change according to the size of SharpCap Window and to any changes in the height of the LiveStacking Window (and whether it is docked or not) and on the Width of the Camera Window. So one would need to have a way of inputting the positions of the relevant Auto buttons at the start of session and rely on one making no changes to the size of the SharpCap main window or any of its sub-windows in the session, otherwise the automated mouse clicks wouldn't hit their intended button or worse, hit something they shouldn't.

Instead of taking the Stacked Colour.png file as my 'interim' picture I suppose I could take the Stacked .fits, pass it to another application, set its black/white range to some purposeful range and then save/convert that to be my 'interim 'picture. I have a automated work flow for doing similar to this using CCDSoft and ImageMagicK, but it would do anything other than a linear stretch and produce a black & white product (at least colour balance wouldn't be an issue 8-) ) . There are other applications that I could look at but they may not all have the necessary API or command line versions to do the necessary auto-balance/auto-stretch via a automated workflow, and hence my desire to be able to this this in the SharpCap scripting environment if possible (at least at some future point).
David
Post Reply