×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

INDI Client Development in C++ Property Problems

  • Posts: 6
  • Thank you received: 0
Hi,

I'm attempting to add INDI support into my capture application. Currently, I have INDI mounts, filter wheels and focus devices working well but I am having various problems with implementing INDI cameras. The most significant problem is as follows:

Description of the Problem

My application needs to know various pieces of information before it can start to receive and process image data. The information needed are things like width, height, capture format and whether the camera is operating in 8 or 16-bit mode. This information is required so that I can size memory buffers and correctly save image data in various different image types (TIFF, PNG, FITS etc). I am able to reliable get the width and height values from CCD_FRAME, and the bit depth value from CCD_INFO / CCD_BITSPERPIXEL. My problems start when I attempt to discover the current capture format.

I have a block of code in newProperty(INDI::Property *property) which is supposed to hold a pointer to the CCD_CAPTURE_FORMAT property. Whilst this works for many INDI camera drivers, it does not work for all of them. The code looks something like this:
void indi_cam::newProperty(INDI::Property *property)
{
        string prop_name(property->getName());
 
       	INDI::BaseDevice *bd = property->getBaseDevice();
	if (bd->getDriverInterface() & INDI::BaseDevice::CCD_INTERFACE)
	{
                if ((prop_name == "CCD_CAPTURE_FORMAT"))
		{
                       m_svp_capture_format = property->getSwitch();
                }
        }
}

The problem that I am having is that some INDI drivers never offer the CCD_CAPTURE_FORMAT property and so m_svp_capture_format is often null. Just to be clear, this is not the case with all INDI Drivers. For example, CCD_CAPTURE_FORMAT works as expected for Atik and QHY drivers but not for Touptek or ZWO. I have, however, discovered a strange workaround that works in all cases. The workaround is detailed below.

Workaround

If I discover that CCD_CAPTURE_FORMAT is null, I programmatic create a new INDI instance and then connect that instance to the INDI server and then disconnect it and destroy the instance. Once I do this, newProperty(INDI::Property *property) runs again but this time CCD_CAPTURE_FORMAT is available which I can then use m_svp_capture_format in the normal way.

I discovered this accidentally by connecting another INDI application (phd2) to the same server whilst my application was attempting to check for the availability of CCD_CAPTURE_FORMAT. I noticed as I connected phd2 that CCD_CAPTURE_FORMAT suddenly became available.

Although this workaround serves the purpose, it's clearly not idea. Does anybody know how I can ensure that CCD_CAPTURE_FORMAT becomes available without having to use this workaround? Many of the cameras that I am using for the implementation have multiple capture formats (example, Mono, Raw-8, Raw-16, RGB24 etc). It's vital that I know the capture format reliably so that buffers can be sized and decisions about data processing can be made. An obvious example here would be to know if the image data needs to be passed through my debayering algorithms.

Just for a little more information. I attempted to discover the existence of CCD_CAPTURE_FORMAT by using the following code. The results were the same, that is CCD_CAPTURE_FORMAT property was null but becomes available if another instance is connected to the same INDI server.
if(m_base_device != nullptr)
{
    ISwitchVectorProperty *svp = m_base_device->getSwitch("CCD_CAPTURE_FORMAT");
    if(svp == nullptr)
    {
         throw std::runtime_error("CCD_CAPTURE_FORMAT is null");
    }
}

Thanks for reading and if you need further information then please ask. I may have other questions but this is the most important one for now.

Amanda,
1 year 6 months ago #86665

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I think when you receive the BLOB (the image) from INDI, one of the fields is "format". So you may have to wait until you actually receive an image before deciding what type it is.

Also, one of the standard INDI properties is CCD_CFA, which has information needed for debayering (if appropriate).

Keep in mind I don't write many INDI clients. I work mostly on the driver side of things. So I might be wrong. :)
Last edit: 1 year 6 months ago by Kevin Ross.
1 year 6 months ago #86666

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
Hi Kevin and thanks for your response.

I've just had a look at IBLOB::format but this just contains ".fits" and not the pixel format information such as "RAW-8, RAW16 etc".

Any other ideas?

Amanda.
1 year 6 months ago #86681

Please Log in or Create an account to join the conversation.

  • Posts: 421
  • Thank you received: 102
I guess you'll just have to look in the FITS header then, which presumably you're doing anyway in order to decode the image.
1 year 6 months ago #86689

Please Log in or Create an account to join the conversation.

  • Posts: 6
  • Thank you received: 0
Thanks Kevin. I appreciate your help.
1 year 6 months ago #86863

Please Log in or Create an account to join the conversation.

That's CCD_CAPTURE_FORMAT property
1 year 6 months ago #86890

Please Log in or Create an account to join the conversation.

Time to create page: 0.548 seconds