Products > Thermal Imaging

FLIR A65X Saving image in raw format using eBUS SDK

(1/2) > >>

khedar:
I am trying to write a program which connects to a FLIR AX5(GigE Vision) camera and then save images after regular intervals to a pre-specified location on my PC. These images must be 14bit which contains the temperature information. Later I need to process these images using openCV to get some meaningful results from obtained temperature data.

As of now I can save image at regular interval but the image which I am getting doesn't contain 14 bit data but 8 bit data instead. This even after I change the PixelFormat to 14 bit, CMOS and LVDT bit depths to 14 bit. I checked the resulting .bin file in matlab and found that the max pixel value is 255 which means image is being stored in 8 bit format. I am using the sample code provided by eBus SDK to do this job. In this code I have made some changes as per my requirement.

Please help in saving the image in the raw format from which I can read the temperature data. P.S. Relevant code is here.


--- Code: ---// If the buffer contains an image, display width and height.
            uint32_t lWidth = 0, lHeight = 0;
            lType = lBuffer->GetPayloadType();

            cout << fixed << setprecision( 1 );
            cout << lDoodle[ lDoodleIndex ];
            cout << " BlockID: " << uppercase << hex << setfill( '0' ) << setw( 16 ) << lBuffer->GetBlockID();

            if (lType == PvPayloadTypeImage)
            {

                // Get image specific buffer interface.
                PvImage *lImage = lBuffer->GetImage();
                // Read width, height.
                lWidth = lImage->GetWidth();
                lHeight = lImage->GetHeight();
                cout << "  W: " << dec << lWidth << " H: " << lHeight;
                lBuffer->GetImage()->Alloc(lWidth, lHeight, lBuffer->GetImage()->GetPixelType());
                if (lBuffer->GetBlockID()%50==0) {
                    char filename[]= IMAGE_SAVE_LOC;
                    std::string s=std::to_string(lBuffer->GetBlockID());
                    char const *schar=s.c_str();
                    strcat(filename, schar);
                    strcat(filename,".bin");
                    lBufferWriter.Store(lBuffer,filename);
                }
--- End code ---

khedar

tomas123:
this is a another 14 Bit Flir format, as described in this Forum (Flir *.fff and Flir radiometric *.jpg)

GenICam protocol
see attachment

but on page 16, I see the old Flir formula  :-+
"Temperature (in Kelvin) = B / log(R / (S - O) + F), where S is the 14-bit digital signal value. log(x) is the base-e logarithm of the x parameter"

further information for this formula see here (look for RAW2Temp.xls):
https://www.eevblog.com/forum/thermal-imaging/flir-e4-thermal-imaging-camera-teardown/msg342072/#msg342072

khedar:
Hi Tomas, Thanks for the links. I have skimmed through the thread and it has lots of great information.
   Coming to the problem I was facing. It seems that the function "Store" PvBufferwriter was by default saving the files in 8 bit format. Found this in the header declaration.


--- Code: ---    PvResult Store( PvBuffer* aBuffer, const PvString& aFilename, PvBufferFormatType aType = PvBufferFormatBMP, uint32_t *aBytesWritten = NULL );

--- End code ---
from PvBufferWriter.h file.

I have written a new function to write the raw sensor values to a binary file based on the example from GEV 1.9 source code.

--- Code: ---void SaveAsRaw(PvBuffer *lBuffer, uint32_t lSize, char* lFilename)
{
    const uint8_t* lSource=lBuffer->GetDataPointer();
    std::ofstream file(lFilename,std::ofstream::binary);
    file.write(reinterpret_cast<const char *>(lSource), lSize);
    file.close();
}
--- End code ---
But I am yet to test this as I won't have access to the camera until this Thursday (Excursion Woche   :( ). Once this works will then try to store in .fff format since that header file also is available in GEV source code.
Lots of fun ahead.
I will try to keep my work posted on this thread so that it might help anyone else working on a similar problem.

khedar

Chanc3:
Which A series camera is it? A655 or A65? Have you considered using a different sdk?


Sent from my iPad using Tapatalk

khedar:
Hi Chanc3,
I have A65X model. FLIR recommends using eBUS SDK and I have found it be great. So at the moment I am going ahead with eBUS only. I am trying with the new function I wrote for saving the raw file will update later.

khedar

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod