Ask Your Question
0

Create camera calibration project in Visual Studio 2015

asked 2017-02-25 11:50:07 -0600

SniFFzoR gravatar image

Hi,

In order to be able to calibrate my camera, I downloaded visual studio and tried to create a camera calibration project. However, when I create a project (I choose Win32 Console Application -> Application Type = Console Application. Then, in the file that is created (called Testing.cpp) I try to paste the code from C:\OpenCV\opencv\samples\cpp\tutorial_code\calib3d\camera_calibration\camera_calibration.cpp into my Testing.cpp-file. When I do that, every line that contains "#include" is red.

Since I don't normally work with OpenCV in Visual Studio, I don't know how to resolve this. It would be awesome if anyone could point me in the correct direction.

edit retag flag offensive close merge delete

Comments

Don't you use CMake with VS 2015 ? Follow this post of course without QT

LBerger gravatar imageLBerger ( 2017-02-25 14:35:19 -0600 )edit

I did use CMake. I followed this tutorial.

SniFFzoR gravatar imageSniFFzoR ( 2017-02-25 14:50:57 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-25 15:08:06 -0600

LBerger gravatar image

updated 2017-02-25 15:15:18 -0600

Try like this

  1. Create a folder MyCalibration
  2. Create a file CMakeLists.txt in this folder
  3. Write in this file (at the end of the post
  4. Then open CMake
  5. In "where is Source Code" give MyCalibration
  6. in Where to build the Binaries gives MyCalibration (with full path in both case)
  7. Click in configure
  8. Click in Generate
  9. Click in Open Project (for Cmake >3.7.1)

and build your project.Select sub project myCalibration to run your application

If CMake cannot find Opencv you have to give opencv folder where you download or build opencv.

cmake_minimum_required(VERSION 2.8)
PROJECT (MyCalibration)
find_package(OpenCV  REQUIRED)
file(GLOB MyCalibration_SRCS
    "*.h"
    "*.cpp")
ADD_EXECUTABLE (MyCalibration ${MyCalibration_SRCS})
if (OpenCV_FOUND)
    include_directories( ${OpenCV_INCLUDE_DIRS} )
    target_link_libraries( MyCalibration ${OpenCV_LIBS} )
else (OpenCV_FOUND)
message("PB->OPENCV = ${OpenCV_INCLUDE_DIRS}") 
endif (OpenCV_FOUND)
edit flag offensive delete link more

Comments

I'm not sure that I understand. I have a OpenCV.sln-file that I can open. It is when I create a new project in Visual Studio, and paste the code from camera_calibration.cpp into the new project that makes it all strange.

SniFFzoR gravatar imageSniFFzoR ( 2017-02-25 16:10:08 -0600 )edit

I have done what you stated above, but it puts me no where closer. I have a OpenCV.sln file in MyCalibration, but if I want to create a new project, copy some code from a file in F:\opencvfin\samples\cpp\tutorial_code\calib3d\camera_calibration and paste it into my project, I only get erros in the project. My problem is that I don't have a clue on how to solve this. The most ridiculous thing here is that I have a masters degree in computer engineering, and this is the most difficult thing I've ever done. Seems unecessary to be this complex.

SniFFzoR gravatar imageSniFFzoR ( 2017-02-25 18:09:49 -0600 )edit

"Paste the code in new project" no : copy source file in folder and run cmake again. CMake will update your new project. Look at my gihub I have got many folder with source file and a cmakelists.txt . I run cmake and it gives a sln (on windows)... What are errros in your project?

LBerger gravatar imageLBerger ( 2017-02-25 21:26:46 -0600 )edit

I do as this dude does it: https://www.youtube.com/watch?v=l4372... If you watch from maybe 6:40 to 8:00, you will see the errors that I get as well.

I'm not entirely sure that I understand what you mean with "source file in folder". What is the source file and in what folder is it?

SniFFzoR gravatar imageSniFFzoR ( 2017-02-25 21:45:25 -0600 )edit

In this video I cannot see CMake. You have to set manually inculde path and lib path manually. You should install opencv like in this post (without checking QT)

LBerger gravatar imageLBerger ( 2017-02-26 02:46:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-02-25 11:50:07 -0600

Seen: 501 times

Last updated: Feb 25 '17