Hello,
I am in need of some help. The task I am trying to accomplish for my project is, seemingly, simple:
What I have:
A ZWO ASI290mm
A Raspberry Pi 3b+, with the ZWO ASI SDK downloaded and installed, and the latest version of OpenCV installed.
What I am trying to do:
The task I want to do is simple: take a (or several in a loop) full resolution raw exposure (of type RAW16) with the ASI290mm and store it as a 16 bit tiff. For this application, I don't care about seeing the result, having a reduced ROI, video capture, or anything of that nature. I don't even particularly care about user input to set such things as image type, etc, these can be statically set in the program. I just want to capture and store the frame, as described.
What I have tried:
I have looked at the demo code that comes with the SDK, and have taken one of those programs and sort of chopped it up to reduce it to what I want to do above. I have some problem and concerns, however. The call to save an image, when uncommented in the demo program, reads like this:
if(bsave)
cvSaveImage("saveImage.jpg", pRgb);
bSave = false;
Where pRgb is defined earlier as:
IplImage *pRgb;
And this seems to be the failing point in compiling this program. The error output is this:
error: 'cvSaveImage' was not declared in this scope
After some digging, it seems that the whole demo program is using the old C API for OpenCV (old as of OpenCV 1.x, we are now on OpenCV 4.x), which includes the whole IplImage and cvSaveImage stuff, so every troubleshooting search I have done has basically resulted in people saying "use the new C++ API which takes care of garbage collection using Mat instead of IplImage and imwrite() instead of cvSaveImage, etc".
So I've come to the conclusion that I have to redo things in the new C++ way. However, I'm not sure how. I assume I need to declare a Mat, something like
Mat img(height,width, CV_16UC1);
I see that in the suggested call sequence, there is ASIStartExposure, ASIGetExpStatus, and finally if ASI_EXP_SUCCESS then ASIGetDataAfterExp. That sequence makes sense to me. But I'm not sure how to go from that sequence to implementing it such that the data is captured by OpenCV and written as a tiff.
Could someone kindly help me?
Thanks,
Jacob