cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
1,619 Views
Registered: ‎05-08-2018

error imread function



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

0 Kudos
Reply
1 Reply
Moderator
Moderator
1,490 Views
Registered: ‎06-24-2015

@tsachy

 

Which version of opencv are you using?

Opencv 3.x implements imread in the package imgcodec, which is not existing in previous Opencv versions.

 

Thanks,
Nupur
--------------------------------------------------------------------------------------------
Google your question before posting. If someone's post answers your question, mark the post as answer with "Accept as solution". If you see a particularly good and informative post, consider giving it Kudos (click on the 'thumbs-up' button).
0 Kudos
Reply