我编写了一个我在网上用opencv编写的简短示例程序时,过去几天一直在尝试解决我遇到的错误。应用程序的代码可以在下面找到,控制台命令和错误如下。任何和所有的帮助表示赞赏。
.cpp文件:
@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:hibernate.properties" })
public class RepositoryConfiguration {
@Autowired
private Environment environment;
@Bean(name="sessionFactory")
public LocalSessionFactoryBean sessionFactory() {
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setHibernateProperties(hibernateProperties());
sessionFactory.setPackagesToScan(new String[] { "com.project" });
return sessionFactory;
}
@Bean
public Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.hbm2ddl.auto", "update");// environment.getRequiredProperty("hibernate.hbm2ddl.auto")
return properties;
}
@Bean(name = "datasource")
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
return dataSource;
}
@Bean
@Autowired
@Qualifier(value = "sessionFactory")
public HibernateTransactionManager transactionManager(SessionFactory s) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
}
控制台命令和错误:
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main(){
Mat img = imread("/home/pi/opencv/testPic.jpg",CV_LOAD_IMAGE_COLOR);
imshow("opencvtest",img);
waitKey(0);
return 0;
}
答案 0 :(得分:0)
您必须将您的二进制文件与OpenCV相关联...假设您正确安装了OpenCV,可以使用以下命令:
g++ -o cppTest cppTest.cpp -lopencv_core -lopencv_highgui -lopencv_imgproc