Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/149.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从CCfits获取图像数据 我试图用C++来阅读和编写适合的图像。我正在尝试使用CCfits,但我不知道如何获得像素缓冲区。我使用文档中的示例代码成功地读取了图像并打印出了主标题,但在尝试读取二进制数据数组时出错。下面是CCfits示例中提供的代码(我已经指出了错误所在) int readImage() { std::auto_ptr pInfile(新FITS(“atestfil.fit”,读,真)); PHDU&image=pInfile->PHDU(); std::数组内容; //读取图像中所有用户指定的、坐标和校验和键 image.readAllKeys(); image.read(contents);/!!!此处出错!!! //这不打印数据,只打印标题信息。 std::cout_C++_Image_Fits - Fatal编程技术网

如何从CCfits获取图像数据 我试图用C++来阅读和编写适合的图像。我正在尝试使用CCfits,但我不知道如何获得像素缓冲区。我使用文档中的示例代码成功地读取了图像并打印出了主标题,但在尝试读取二进制数据数组时出错。下面是CCfits示例中提供的代码(我已经指出了错误所在) int readImage() { std::auto_ptr pInfile(新FITS(“atestfil.fit”,读,真)); PHDU&image=pInfile->PHDU(); std::数组内容; //读取图像中所有用户指定的、坐标和校验和键 image.readAllKeys(); image.read(contents);/!!!此处出错!!! //这不打印数据,只打印标题信息。 std::cout

如何从CCfits获取图像数据 我试图用C++来阅读和编写适合的图像。我正在尝试使用CCfits,但我不知道如何获得像素缓冲区。我使用文档中的示例代码成功地读取了图像并打印出了主标题,但在尝试读取二进制数据数组时出错。下面是CCfits示例中提供的代码(我已经指出了错误所在) int readImage() { std::auto_ptr pInfile(新FITS(“atestfil.fit”,读,真)); PHDU&image=pInfile->PHDU(); std::数组内容; //读取图像中所有用户指定的、坐标和校验和键 image.readAllKeys(); image.read(contents);/!!!此处出错!!! //这不打印数据,只打印标题信息。 std::cout,c++,image,fits,C++,Image,Fits,看来CCfits并没有真正像广告中所宣传的那样工作。read()函数有文档记录,甚至在头文件中声明,但没有实现 只需使用cfitsio,它就可以工作。我发现,为了使CCfits正常工作,您需要使用#include。只包含您认为需要的文件不会影响函数的实现 我还发现您需要稍微修改代码,并指定一个非零长度的valarray(至少对于较新的gcc版本(8.x.y))。我发现只使用cfitsio更容易。 int readImage() { std::auto_ptr<FITS> pI

看来CCfits并没有真正像广告中所宣传的那样工作。read()函数有文档记录,甚至在头文件中声明,但没有实现


只需使用cfitsio,它就可以工作。

我发现,为了使CCfits正常工作,您需要使用
#include
。只包含您认为需要的文件不会影响函数的实现


我还发现您需要稍微修改代码,并指定一个非零长度的valarray(至少对于较新的gcc版本(8.x.y))。

我发现只使用cfitsio更容易。
int readImage()
{
    std::auto_ptr<FITS> pInfile(new FITS("atestfil.fit",Read,true));
    PHDU& image = pInfile->pHDU();
    std::valarray<unsigned long>  contents;

    // read all user-specifed, coordinate, and checksum keys in the image
    image.readAllKeys();
    image.read(contents); // !!!ERROR HERE!!!

    // this doesn’t print the data, just header info.
    std::cout << image << std::endl;
    long ax1(image.axis(0));
    long ax2(image.axis(1));

    for (long j = 0; j < ax2; j+=10)
    {
        std::ostream_iterator<short> c(std::cout,"\t");
        std::copy(&contents[j*ax1], &contents[(j+1)*ax1-1], c);
        std::cout << '\n';
    {
    std::cout << std::endl;
    return 0;
}
undefined reference to `void CCfits::PHDU::read<unsigned long>(std::valarray<unsigned long>&)'
 template<typename S>
        void read(std::valarray<S>& image) ;