0
我使用imread(..,...- GRAYSCAle)將圖像(png)文件直接從3個通道放置到1個通道,我可以在灰度上看到圖像,但像素值爲0,而不是1。不勝感激!爲什麼在imread載入圖像後像素值爲0?
cv::Mat image=cv::imread(filename1, CV_LOAD_IMAGE_GRAYSCALE);
if (!image.data){
std::cout<<"Problem laoding image";
}
cv::namedWindow("Window1");
cv::imshow("Window1",image);
for (i=0;i<720;i++){
for (j=0;j<720;j++){
std::cout<<image.at<int>(j,i)<<std::endl;
//printf("%d \t", vPixel);
}
}
當我切換到uchar後,什麼也不打印。 –