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

#1

Post by yifei »

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: 13122
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: get histogram of captured image

#2

Post by admin »

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

#3

Post by yifei »

Thank you Robin, this is very useful!
Could you please also tell me the params for SkyCoordConverter?
User avatar
admin
Site Admin
Posts: 13122
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: get histogram of captured image

#4

Post by admin »

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: 13122
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: get histogram of captured image

#5

Post by admin »

New build uploaded - you should now see parameter lists like this
Capture.JPG
Capture.JPG (36.05 KiB) Viewed 3417 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

#6

Post by yifei »

wow. awesome! Thank you!
Post Reply