Register    Login    Forum    Search    FAQ

Board index » Software » Linux




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post Posted: Mon Mar 20, 2017 12:08 am 
Offline

Joined: Sun Mar 19, 2017 10:01 pm
Posts: 9
Dear Sir / Madam

I am in the process of implementing a Linux Astronomical Image Capture application which supports many cameras. I have the ZWO ASI120MC working perfectly in 8bit mode (RAW8) but am having problems with extracting buffers which take advantage of the 12 bit ADC.

At first, I assumed that I would need to pass in a 16-bit unsigned integer into ASIGetVideoData() together with a buffer size parameter. However, I now see that I need to pass in an 8-bit unsigned integer (aka unsigned char) with a buffer size parameter of width * height * 2.

My question is: How is the data formatted in the resulting image buffer? For example, is the data formatted as follows:

Code:
// First pixel brightness value: buffer[0]
// corresponding pixel brightness value: buffer[width*height]

// 16 bit value
uint16_t px = buffer[0] * buffer[width * height];



Or, it it as follows:

Code:
// First pixel brightness value:   buffer[0]
// corresponding pixel brightness value: buffer[1]

// 16 bit value
uint16_t px = buffer[0] * buffer[1];



If none of the above I would be grateful if you would explain how I obtain pixel values greater than 8 bits (256) from your function ASIGetVideoData().

Another question, does your SDK scale the values from the 12 bit ADC into the full range of 16-bits. That is, 0 through to 65535?

I am not using OpenCV in my project.

My thanks in advance
Regards
Nikki


Top 
 Profile  
Reply with quote  
 Post Posted: Mon Mar 20, 2017 1:34 am 
Offline
Site Admin

Joined: Fri Jul 25, 2014 2:43 am
Posts: 192
for 16bit, we put low 8bit in one byte and high 8bit in neighbouring byte,
so, uint16_t px = buffer[0] + 256* buffer[1]
or uint16_t px = 256*buffer[0] + buffer[1]
you can try both to see which works

with C language you just need to use type cast to convert unsigned char to unsigned short:
unsigned char *pBuff8;
unsigned short *pBuff16;
...
pBuff16 = (unsigned short*)pBuff8;

_________________
ZWO software engineer
Location:lon=120.6 lat=31.3
SuZhou China


Top 
 Profile  
Reply with quote  
 Post Posted: Mon Mar 20, 2017 5:31 pm 
Offline

Joined: Sun Mar 19, 2017 10:01 pm
Posts: 9
Dear SuZhou

Thank you for your speedy response. I would be grateful if you would clarify the following:

In your answer to my original post, you gave me two options.

1: uint16_t px = buffer[0] + 256* buffer[1]
2: uint16_t px = 256*buffer[0] + buffer[1]

I am unable to get option 2 to work. Instead of a nice clean image I get lots of noise. What I would really like to achieve is to have values ranging from 0 to 4095 (4095 being the maximum from a 12 bit ADC) in my unsigned 16 bit integer array. Is this possible? I know that this would produce a dark image but the image could then be stretched in Photoshop or bit shifted to make it brighter.

Option 1 seems to yield values covering almost the entire range of 16 bits.

Kind Regards
NikkiM


Top 
 Profile  
Reply with quote  
 Post Posted: Tue Mar 21, 2017 1:33 am 
Offline
Site Admin

Joined: Fri Jul 25, 2014 2:43 am
Posts: 192
the maximun value at RAW16 mode is 65535, actually we move the 12bit data to higher bit by 4bit to convert it to 16bit data.

_________________
ZWO software engineer
Location:lon=120.6 lat=31.3
SuZhou China


Top 
 Profile  
Reply with quote  
 Post Posted: Wed Mar 22, 2017 11:18 pm 
Offline

Joined: Sun Mar 19, 2017 10:01 pm
Posts: 9
Thank you for you help.

Nikki


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 5 posts ] 

Board index » Software » Linux


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: