08-01-2018 10:57 PM
when using misread function (to read bmp file ) i get the error message "undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'"
i do not understand this error ,i try everything without solution any ideas?
the code :
#include <stdio.h>
#include "core.h"
//#include<core.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <hls_opencv.h>
#include "hls_opencv.h"
#include "hls_video.h"
#define INPUT_IMAGE_CORE "D:\\test.bmp"
#define FILE_HISTOGRAM "Histogram.txt"
char outImage[320][240];
int histo[256];
int LutMult[256];
void saveImage(const std::string path,cv::InputArray inArr)
{
double min;
double max;
cv::minMaxIdx(inArr,&min,&max);
cv::Mat adjMap;
cv::convertScaleAbs(inArr,adjMap,255/max);
cv::imwrite(path,adjMap);
}
void saveHistogram (const char* filename ,int *histPointer)
{
//Open file to compare later....
FILE *pFile;
pFile=fopen(filename ,"w");
if (pFile !=NULL)
{
for (int idx=0;idx<256;idx++)
{
fprintf(pFile,"Bin[%d]=%d\n",idx,histPointer[idx]);
}
}
}
int main()
{
//read input image
printf("Load image %s\n",INPUT_IMAGE_CORE);
cv::Mat imageSrc;
imagesrc=cv::imread(INPUT_IMAGE_CORE);
//convert to grayScale
cv::cvtColor(imageSrc,imageSrc,CV_BGR2GRAY);
printf("Image Row:%d Cols:%d\n",imageSrc.rows,imageSrc.cols);
//Define stream for input and output
hls::stream<uint_8_side_channel> inputStream;
//Populate the input stream with the image bytes
for (int idxRows=0 ;idxRows <imageSrc.rows;idxRows++)
{
for (int idxCols=0;idxCols<imageSrc.cols;idxCols++)
{
uint_8_side_channel valIn;
valIn.data=imageSrc.at<unsigned char>(idxRows,idxCols);
valIn.keep=1;valIn.strb=1;valIn.user=1;valIn.id=0;valIn.dest=0;
inputStream<<valIn;
}
}
doHist(inputStream,histo);
saveHistogram("Histogram.txt",histo);
return 0;
}
thank you
Tsachy
08-31-2018 10:33 AM
Which version of opencv are you using?
Opencv 3.x implements imread
in the package imgcodec
, which is not existing in previous Opencv versions.