get histogram of captured image

Discussions on extending SharpCap using the built in Python scripting functionality
Post Reply
yifei
Posts: 5
Joined: Sun Dec 31, 2017 9:27 pm

get histogram of captured image

Post by yifei » Mon Oct 29, 2018 3:44 pm

I'd like to get the histogram of my captured image so I can adjust the exposure time automatically. Is there a lib/function to do so?

I have two more questions

- I also see there is a function SharpCap.ImageProcessing.SkyCoordConverter.ConvertAltAzToRaDec, what's the params types of this and how to use it? how can I learn the param myself?
- I'm trying to import numpy but directly adding it to path seems not working.
What I did is use site.addsitedir(r'my\anaconda2\lib\site-packages')
import numpy
then it syas: ImportError, cannot import nultiarray from numpy.core
What's the correct way if I want to use numpy here?

Thanks!

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

Re: get histogram of captured image

Post by admin » Mon Oct 29, 2018 9:58 pm

Hi,

see this thread - viewtopic.php?f=14&t=1141 - for details on how to get notification of each frame being captured and in particular get the frame object itself. When you have the frame object, frame.GetStats() will give you back the mean and standard deviation of the frame pixel values. Not quite the histogram, but probably enough for a first attempt at this.

I don't think you will be able to import numpy - SharpCap uses IronPython and is only able to import pure python code, where I think numpy uses C code.

I'm not sure why you don't see more help in the UI at the moment for things like the parameters on the SkyCoordConverter - I will investigate if something has broken there.

cheers,

Robin

yifei
Posts: 5
Joined: Sun Dec 31, 2017 9:27 pm

Re: get histogram of captured image

Post by yifei » Tue Oct 30, 2018 12:01 am

Thank you Robin, this is very useful!
Could you please also tell me the params for SkyCoordConverter?

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

Re: get histogram of captured image

Post by admin » Tue Oct 30, 2018 6:40 pm

Hi,

actually I've fixed the bug in SharpCap that stopped the intellisense from showing the parameters - I will upload a new build later today that will let you find that info (and other functions) yourself.

cheers,

Robin

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

Re: get histogram of captured image

Post by admin » Tue Oct 30, 2018 7:15 pm

New build uploaded - you should now see parameter lists like this
Capture.JPG
Capture.JPG (36.05 KiB) Viewed 618 times
To see parameters on a type constructor, enter the name of the type followed by a '.', then use the down arrow key to go down to the method '__new__' in the suggestion list and ignore the first parameter of 'cls: type'.

cheers,

Robin

yifei
Posts: 5
Joined: Sun Dec 31, 2017 9:27 pm

Re: get histogram of captured image

Post by yifei » Wed Oct 31, 2018 2:41 pm

wow. awesome! Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests