【发布时间】:2014-06-19 05:29:42
【问题描述】:
我正在使用 windows8.1、visual studio10 和 Opencv。 这是我的代码
#include "stdafx.h"
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <opencv/cvaux.h>
#include <stdio.h>
using namespace cv;
using namespace std;
int main(int argc, const char * argv[]){
//mat数据结构使用方法
int Arr[256];
int x;
Mat image, A, B;
image = imread("C:/Users/chandanawin8/Desktop/len.jpg", CV_LOAD_IMAGE_COLOR);
for(int a=0; a<255;a++){
Arr[a] = 0; }
//int Arr[256] = {0}
if(!image.data){
printf("Error: Couldn't open the file.\n");
return 2;
}
cvtColor(image, A, CV_RGB2GRAY);
//creating the histogram by taking a count to an arry
for(int i=0; i<A.rows; i++){
for(int j=0; j<A.cols;j++){
x = A.at<uchar>(i,j);
Arr[x] = Arr[x]+1;
if(x<103){
A.at<uchar>(i,j) = 0; }
else if(x<219){
A.at<uchar>(i,j) = (x-103)*(220-1)/(219-103) + 1;
}
else if(x<242){
A.at<uchar>(i,j) = (x-219)*(255-220)/(242-219) +219;
}
else{
}
//pixels from 241 to 255: keep them. if want we can remove it
}
}
for(int a=0; a<255;a++){
std::cout<<"Number of "<<a<<" Value: "<<Arr[a]<<std::endl;
}
//creating the font
//cvInitFont(&font, CV_FONT_HERSHEY_COMPLEX, 3,3, 0.0, 5,8);
//display the image
cvNamedWindow("Main Window", CV_WINDOW_AUTOSIZE);
imshow("Main Window", image);
cvNamedWindow("Display Window", CV_WINDOW_AUTOSIZE);
imshow("Display Window", A);
cv::waitKey(0);
image.release();
A.release();
return 0;
}
运行后出现此错误
'BreailTest2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
The program '[3044] BreailTest2.exe: Native' has exited with code 2 (0x2).
你能帮我解决这个问题吗 几天前它工作了。现在它不工作了。我有点新的opencv和视觉工作室 非常感谢
【问题讨论】:
标签: c++ visual-studio-2010 opencv image-processing dll