Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all 4615 articles
Browse latest View live

How to detect human body(shirt detection) with clear edges rather than rectangle in android application?

$
0
0
Hi We have to create an android application in OpenCV to detect human upper half body i.e shirt detection. We need to get the structure of the shirt exactly with the edges. We are beginners to opencv.. please help us on the same

How to smooth the edges of a low quality image?

$
0
0
I am working on this picture. ![Google Map Satellite Image](/upfiles/14993375227217035.jpg) Due to its bad quality, firstly I use histogram equalization after that bilateral blur to preserve the edges, adaptive Canny and edge sharpening kernel and the output is this:- ![Edge detection](/upfiles/14993377797972683.png) I need the edges to be closed and gone through morphological operations but the results were not satisfactory and the operation can't be generalized on all the images. How to solve this? Here's the code:- [Edge Sharp](https://drive.google.com/open?id=0B4EyyXU6mOf5Z0hBbW4xYUZZTzQ)

Uploading gpumat is too slow in jetson TX1

$
0
0
Hi. I'm now working on jetson TX1 with cuda8.0. I compiled opencv3.1 with cuda and it looks successful. However, when I tried some samples, I found cuda calclation pretty slow mostly because of uploading images. For example, I tried surf feature extraction and matching from opencv sample cord. The result is like below: upLoad = 39.9022 Device 0: "NVIDIA Tegra X1" 3995Mb, sm_53, Driver/Runtime ver.8.0/8.0 FOUND 158 keypoints on first image FOUND 137 keypoints on second image Findcuda = 0.000123487 Extraction = 0.0952315 Matching = 0.00152424 Download = 0.00137919 This means uploading two images took about 40sec! Are there any solutions? Thank you. I put my code here. #include #include "opencv2/opencv_modules.hpp" #ifdef HAVE_OPENCV_XFEATURES2D #include "opencv2/core.hpp" #include "opencv2/features2d.hpp" #include "opencv2/highgui.hpp" #include "opencv2/cudafeatures2d.hpp" #include "opencv2/xfeatures2d/cuda.hpp" using namespace std; using namespace cv; using namespace cv::cuda; static void help() { cout << "\nThis program demonstrates using SURF_CUDA features detector, descriptor extractor and BruteForceMatcher_CUDA" << endl; cout << "\nUsage:\n\tsurf_keypoint_matcher --left --right " << endl; } int main(int argc, char* argv[]) { if (argc != 5) { help(); return -1; } GpuMat img1, img2; cv::Mat raw1,raw2; raw1 = imread(argv[2], IMREAD_GRAYSCALE); raw2= imread(argv[4], IMREAD_GRAYSCALE); int64 t0 = cv::getTickCount(); for (int i = 1; i < argc; ++i) { if (string(argv[i]) == "--left") { img1.upload(raw1); CV_Assert(!img1.empty()); } else if (string(argv[i]) == "--right") { img2.upload(raw2); CV_Assert(!img2.empty()); } else if (string(argv[i]) == "--help") { help(); return -1; } } int64 t1 = cv::getTickCount(); cout << " upLoad = " << (t1-t0)/cv::getTickFrequency() << endl; cv::cuda::printShortCudaDeviceInfo(cv::cuda::getDevice()); int64 t2 = cv::getTickCount(); SURF_CUDA surf; // detecting keypoints & computing descriptors GpuMat keypoints1GPU, keypoints2GPU; GpuMat descriptors1GPU, descriptors2GPU; surf(img1, GpuMat(), keypoints1GPU, descriptors1GPU); surf(img2, GpuMat(), keypoints2GPU, descriptors2GPU); int64 t3 = cv::getTickCount(); cout << "FOUND " << keypoints1GPU.cols << " keypoints on first image" << endl; cout << "FOUND " << keypoints2GPU.cols << " keypoints on second image" << endl; cout << " Findcuda = " << (t2-t1)/cv::getTickFrequency() << " Extraction = " << (t3-t2)/cv::getTickFrequency() << endl; // matching descriptors Ptr matcher = cv::cuda::DescriptorMatcher::createBFMatcher(surf.defaultNorm()); vector matches; matcher->match(descriptors1GPU, descriptors2GPU, matches); int64 t4 = cv::getTickCount(); // downloading results vector keypoints1, keypoints2; vector descriptors1, descriptors2; surf.downloadKeypoints(keypoints1GPU, keypoints1); surf.downloadKeypoints(keypoints2GPU, keypoints2); surf.downloadDescriptors(descriptors1GPU, descriptors1); surf.downloadDescriptors(descriptors2GPU, descriptors2); int64 t5 = cv::getTickCount(); cout << " Matching = " << (t4-t3)/cv::getTickFrequency() << " Download = " << (t5-t4)/cv::getTickFrequency() << endl; // drawing the results Mat img_matches; drawMatches(Mat(img1), keypoints1, Mat(img2), keypoints2, matches, img_matches); namedWindow("matches", 0); imshow("matches", img_matches); waitKey(0); return 0; } #else int main() { std::cerr << "OpenCV was built without xfeatures2d module" << std::endl; return 0; } #endif

License Plate images database(Indian Licence Plate is preferable)

$
0
0
Hi, I am working on License Plate Recognition project using OpneCV cascade classifier. For that i need license plate images to train data. Can anybody tell me where i can get license plate database ?

Structure from motion example_sfm_scene_reconstruction

$
0
0
Hello. i am trying to load a dataset images to example_sfm_scene_reconstruction with: ./example_sfm_scene_reconstruction data/images/temple/dataset_files.txt 230 460 320 and i get: Initialize nViewMatcher ... OK F1011 22:09:35.299096 32252 nRobustViewMatching.cc:57] Failed loading image: data/images/temple/ *** Check failure stack trace: *** @ 0x7f027e9a25cd google::LogMessage::Fail() @ 0x7f027e9a4433 google::LogMessage::SendToLog() @ 0x7f027e9a215b google::LogMessage::Flush() @ 0x7f027e9a4e1e google::LogMessageFatal::~LogMessageFatal() @ 0x7f0280d87d15 libmv::correspondence::nRobustViewMatching::computeData() @ 0x7f0280d853e8 libmv::correspondence::nRobustViewMatching::computeCrossMatch() @ 0x7f0280d516db cv::sfm::libmv_solveReconstructionImpl() @ 0x7f0280d530bf cv::sfm::SFMLibmvReconstructionImpl<>::run() @ 0x7f0280d5ece8 cv::sfm::reconstruct_<>() @ 0x7f0280d5ef4c cv::sfm::reconstruct() @ 0x402b45 main @ 0x7f027f094830 __libc_start_main @ 0x4057e9 _start @ (nil) (unknown) Performing Cross Matching ... Abortado (`core' generado) ---------------------------------------------------- data/images/temple/dataset_files.txt temple0001.jpg temple0002.jpg temple0003.jpg temple0004.jpg How can i solved this issue?

OPENCV 3.3 CMAKE error in windows 10

$
0
0
Trying to compile opencv 3.3 with IPP in windows 10 with mingw . Earlier With IPP was giving error. That is solved with the patch given in this forum. But now I am getting the following error in CMAKE. Any help appreciated. thanks in advance. Configuring done CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_core" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_flann" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_imgproc" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_ml" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_objdetect" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_phase_unwrapping" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_photo" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_plot" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_reg" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_surface_matching" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_video" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_xphoto" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_bgsegm" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_dnn" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_face" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_fuzzy" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_img_hash" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_imgcodecs" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_shape" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_videoio" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_xobjdetect" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_highgui" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_superres" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_bioinspired" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_dpm" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_features2d" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_line_descriptor" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_saliency" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_text" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_calib3d" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_ccalib" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_datasets" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_rgbd" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_stereo" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_structured_light" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_tracking" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_videostab" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_xfeatures2d" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_ximgproc" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_aruco" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_optflow" which requires target "RunTmChkAlt" that is not in the export set. CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_stitching" which requires target "RunTmChkAlt" that is not in the export set. Generating done

iOS - How to find the difference area in the two images

$
0
0
I'm new to the OpenCV. I want to find the difference area in the two images. [C:\fakepath\image1.png](/upfiles/15078763992897823.png) [C:\fakepath\image2.png](/upfiles/150787642692405.png) In the attached images, i need to find the different area i.e, the small circle coordinates. Please guide me to do it. Thanks.

3.3 Build with VS2015 Errors

$
0
0
Hi I am getting too much error while building the generated CMake source by VS2015. I also include contrib libraries. CMake generation output is below CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy): The OLD behavior for policy CMP0020 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy): The OLD behavior for policy CMP0022 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. CMake Deprecation Warning at CMakeLists.txt:94 (cmake_policy): The OLD behavior for policy CMP0026 will be removed from a future version of CMake. The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD. found Intel IPP (ICV version): 2017.0.2 [2017.0.2] at: C:/opencv33/build/3rdparty/ippicv/ippicv_win found Intel IPP IW binaries: 2017.0.2 at: C:/opencv33/build/3rdparty/ippicv/ippicv_win/../ippiw_win/ Could not find OpenBLAS include. Turning OpenBLAS_FOUND off Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off A library with BLAS API not found. Please specify library location. LAPACK requires BLAS A library with LAPACK API not found. Please specify library location. Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file Caffe: NO Protobuf: NO Glog: NO Looking for tiny_dnn.h Looking for tiny_dnn.h - found Found tiny-dnn in: C:/opencv33/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3 Module opencv_dnn_modern disabled because Protobuf is not found freetype2: NO harfbuzz: NO No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake. Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components. Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags Excluding from source files list: C:/opencv33/build/modules/imgproc/accum.neon.cpp Torch importer has been enabled. To run the tests you have to install Torch ('th' executable should be available) and generate testdata using opencv_extra/testdata/dnn/generate_torch_models.py script. Tesseract: NO General configuration for OpenCV 3.3.0 ===================================== Version control: unknown Extra modules: Location (extra): C:/opencv33/opencv_contrib_master/modules Version control (extra): unknown Platform: Timestamp: 2017-10-13T08:45:37Z Host: Windows 10.0.15063 AMD64 CMake: 3.9.4 CMake generator: Visual Studio 14 2015 Win64 CMake build tool: C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe MSVC: 1900 CPU/HW features: Baseline: SSE SSE2 SSE3 requested: SSE3 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 requested: SSE4_1 SSE4_2 AVX FP16 AVX2 SSE4_1 (2 files): + SSSE3 SSE4_1 SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX AVX2 (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 C/C++: Built as dynamic libs?: YES C++11: YES C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe (ver 19.0.24215.1) C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4589 /MP6 /MD /O2 /Ob2 /DNDEBUG /Zi C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4589 /MP6 /MDd /Zi /Ob0 /Od /RTC1 C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP6 /MD /O2 /Ob2 /DNDEBUG /Zi C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP6 /MDd /Zi /Ob0 /Od /RTC1 Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug Linker flags (Debug): /machine:x64 /debug /INCREMENTAL ccache: NO Precompiled headers: YES Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32 C:/Program Files/Anaconda3/Library/lib/hdf5.lib 3rdparty dependencies: OpenCV modules: To be built: core flann hdf imgproc ml objdetect phase_unwrapping photo plot reg surface_matching video xphoto bgsegm dnn face fuzzy img_hash imgcodecs shape videoio xobjdetect highgui superres ts bioinspired dpm features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching python3 Disabled: world contrib_world Disabled by dependency: - Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz cnn_3dobj cvv dnn_modern freetype matlab sfm Windows RT support: NO GUI: QT: NO Win32 UI: YES OpenGL support: NO VTK support: NO Media I/O: ZLib: build (ver 1.2.8) JPEG: build (ver 90) WEBP: build (ver encoder: 0x020e) PNG: build (ver 1.6.24) TIFF: build (ver 42 - 4.0.2) JPEG 2000: build (ver 1.900.1) OpenEXR: build (ver 1.7.1) GDAL: NO GDCM: NO Video I/O: Video for Windows: YES DC1394 1.x: NO DC1394 2.x: NO FFMPEG: YES (prebuilt binaries) avcodec: YES (ver 57.89.100) avformat: YES (ver 57.71.100) avutil: YES (ver 55.58.100) swscale: YES (ver 4.6.100) avresample: YES (ver 3.5.0) GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO OpenNI2: NO PvAPI: NO GigEVisionSDK: NO DirectShow: YES Media Foundation: NO XIMEA: NO Intel PerC: NO Parallel framework: Concurrency Trace: YES (with Intel ITT) Other third-party libraries: Use Intel IPP: 2017.0.2 [2017.0.2] at: C:/opencv33/build/3rdparty/ippicv/ippicv_win Use Intel IPP IW: prebuilt binaries (2017.0.2) Use Intel IPP Async: NO Use Lapack: NO Use Eigen: NO Use Cuda: NO Use OpenCL: YES Use OpenVX: NO Use custom HAL: NO OpenCL: Include path: C:/opencv33/sources/3rdparty/include/opencl/1.2 Use AMDFFT: NO Use AMDBLAS: NO Python 2: Interpreter: NO Python 3: Interpreter: C:/Program Files/Anaconda3/python.exe (ver 3.6) Libraries: C:/Program Files/Python36/libs/python36.lib (ver 3.6.0) numpy: C:/Program Files/Anaconda3/lib/site-packages/numpy/core/include (ver 1.11.3) packages path: C:/Program Files/Anaconda3/Lib/site-packages Python (for build): C:/Program Files/Anaconda3/python.exe Java: ant: NO JNI: C:/Program Files/Java/jdk1.8.0_131/include C:/Program Files/Java/jdk1.8.0_131/include/win32 C:/Program Files/Java/jdk1.8.0_131/include Java wrappers: NO Java tests: NO Matlab: Matlab not found or implicitly disabled Documentation: Doxygen: NO Tests and samples: Tests: YES Performance tests: YES C/C++ Examples: YES Install path: C:/opencv33/build/install cvconfig.h is in: C:/opencv33/build ----------------------------------------------------------------- Configuring done Generating done And Visual Studio Errors like below: There are 345 errors Severity Code Description Project File Line Suppression State Error C2664 'void cv::dnn::experimental_dnn_v1::Net::getLayerShapes(const std::vector>&,const int,std::vector<_Ty,std::allocator<_Ty>> *,std::vector<_Ty,std::allocator<_Ty>> *) const': cannot convert argument 3 from 'std::vector>' to 'std::vector> *' opencv_text C:\opencv33\opencv_contrib_master\modules\text\src\ocr_holistic.cpp 74 Severity Code Description Project File Line Suppression State Error C2065 'value': undeclared identifier (compiling source file C:\opencv33\opencv_contrib_master\modules\ximgproc\src\dtfilter_cpu.cpp) opencv_ximgproc c:\opencv33\opencv_contrib_master\modules\ximgproc\src\dtfilter_cpu.inl.hpp 145 I dont know where would I start. Any help would be great. Thanks

C++ openCV waitKey(0) not working?

$
0
0
#include #include #include #include using namespace cv; using namespace std; int isSquare(String fileName); int main() { String imgName = "C:/A.jpg"; isSquare(imgName); } int isSquare(String fileName) { Mat img; img = cv::imread(fileName, IMREAD_COLOR); if (img.empty()) { cout << "Could not open or find the image" << endl; return -1; } //namedWindow("display", WINDOW_AUTOSIZE); imshow("display", img); waitKey(0); cout << "hi"; destroyWindow("display"); return 0; } Hi, I'm currently messing around with openCV 3.30, C++, VS2015. Now I'm trying to open an image, but the display window just kept disappear when I execute above code. I commented namedWindow("display", WINDOW_AUTOSIZE); because openCV document says cv:imshow() will automatically create one, and if I un-comment that line I got one gray window, one image window like this. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/x7HXs.png I don't want to got that gray window, and key input for waitKey(0) works only when I focus on gray window, not on image window. So I made that line as a comment. but if I do that, when I execute that code the image window disappears instantly as if I don't have waitKey(0) code. Clearly waitKey(0) is not working because cout<<"hi"; after waitKey(0) was executed. Am I missing something? Is the document wrong and using namedWindow necessary? All I wanted was to get rid of that gray window... any words of wisdom is appreciated, thanks. plus, I got these responses from stackoverflow: ![image description](/upfiles/15079016586931452.png)

Why self compiled Opencv is slower than apt-get package?

$
0
0
Hi community. I have 2 opencv package: one is self-compiled opencv3.1 with cuda and the other is installed using ``` sudo apt-get install ros-kinetic-opencv3```. When I tried the same program on different packages, it appears my self compiled package is much slower than that in ROS. Ex> Template matching with ORB My opencv3.1 : 150 - 200 ms per frame ROS opencv3.2.0-dev : 40~50ms per frame This is tested in python, but I also find my c++ codes have a similar result. Q1. Do you know why it happen and can I fix this by recompiling with some cmake prefix? Q2. Can I pick ROS opencv package for normal cpu function and pick my own package for cuda function? Thank you.

Should the execution time change when I am running MOG2 extractor on image in GPU?

$
0
0
Image size is 640x480 and MOG2 is applied, it executes in 1ms. While if I take above image and copy it 4 times I will get execution time of 3.2ms(This execution time is only of GPU when I am applying the extractor not memory transfer). The time shouldn't jump from 1ms to 3.2ms in my opinion because it is parallel. My system has Cuda 8.0, OpenCV 3.3.0 and 850M Graphics Card.

opencv resize image without common functions

$
0
0
In our school homework, lesson instructor wants me resize a image with two interpolation methods without common resize and interpolation functions. How can do this? help me please. #include "opencv2/opencv.hpp" using cv::Mat; Mat interpNN(Mat image, double scale); Mat interpBilinear(Mat image, double scale); void main() { // read image from file // resize image with interpNN // resize image with interpBilinear // save resized images (to put in your report) } // resizes the image with the nearest neighbor interpolation // scale determines the output size. for example: // scale==2 => output is double the size of input // scale==0.5 => output is half the size of input // scale==0.8 => if input is 800x600, output is 640x480 Mat interpNN(Mat image, double scale) { // fill this function } // resizes the image with bilinear interpolation // scale works the same as in interpNN() Mat interpBilinear(Mat image, double scale) { // fill this function }

Camera Pose Estimation

$
0
0
Can someone give me a brief primer on camera pose estimation? I have the following problem: I have a number of pictures of a single pattern shot at different angles and positions. How can I use openCV to find these camera angles and positions? In all the pictures, the pattern is at the same location.

Edge detection of foot in picture

$
0
0
Hello, I'm trying to find the outline of a foot in the picture, and draw contours. I've tried various methods, but am unable to detect the edges. I was wondering what kind of techniques I could use to get better results. Any help would be appreciated. [C:\fakepath\Figure_2.png](/upfiles/15080339546008804.png) [C:\fakepath\Figure_1.png](/upfiles/15080339183692466.png)

how to use setRNG in opencv-python

$
0
0
Is there any function like setRNG in opencv-python?

Cascade Classifier - detectmultiscale does not return MatOfRect objects

$
0
0
I work on my android application as It mentioned [here](http://answers.opencv.org/question/173490/how-to-recognize-specific-objects/) . I have difficulties with class Cascade Classifier. I use HAAR classifier. I load a trained cascade classifier in xml and then I use method detectMultiScale with parameters (Mat image, MatOfRect detectedObjects). But when I run the application, I always get detected 0 objects, even If I take a photo with an object in the image. I use Opencv 3.2.0. I tried also LBP classifier and still, it is the same. I trained my classifier [in this application](http://amin-ahmadi.com/cascade-trainer-gui/ ) . Does someone have the experience with this GUI training classifier? A type of input image is CV_8UC1. I don't see the problem with loading xml because the statement below is running well, but without returning detected objects as it was mentioned. I haven't tried to train the classifier in the command line yet. But It would be bit of problem because I am on windows platform. But I'll try it. Or did I miss something? Let me know. private CascadeClassifier cascadeClassifier = new CascadeClassifier("/storage/emulated/0/Pics/cascade1.xml"); private MatOfRect matOfRect = new MatOfRect(); public void classifier(Mat object){ if(!cascadeClassifier.empty()) { Imgproc.resize(object, object, new Size(170, 240)); cascadeClassifier.detectMultiScale(object, matOfRect); MyLog.i(MyLog.TAG, matOfRect.size().toString());//It always prints size 1x0 } } The classifier was trained on this kind of object. ![image description](/upfiles/15073100959731118.png)

Aerial View Stitching

$
0
0
Hello Guys, Newbie here, need guidance on picture stitching through python. I have tried stitching through Homography but the result were unsatisfactory due to tilting of stitched frames. What could be the reason of picture being titled and how to correct it, thanks in advance. Cheers.

Matching image position before comparing image

$
0
0
My goal is to make image 1 and image 2 in the same position before comparing and get the difference between images using python. Take this example: ![image description](/upfiles/15081276061336965.png) as you can see image 1 and image 2 is the same image, but image 2 is shifted and have another hole that image one didn't have. I want to compare this two images but first, I need to make image 1 and image 2 in the same position. How would I go about finding the difference in the image? Edit : Real Image ![image description](/upfiles/15081361819685857.png)

Character Recognition using opencv

$
0
0
I am working on one project and in that i need to recognize text/character from image. I have tried OCR but in some cases it gives many false result. For example i have two images 1) ![image description](/upfiles/15081456841984204.png) 2) ![image description](/upfiles/15081457039388967.png) This is clear image but when i try to recognize text it will give me "T" for first image and "S" for second image. Instead it should return "1" and "6". Can anyone tell me what's wrong i am doing and how to improve it?

import cv2 leads to "segmentation fault"

$
0
0
Hello I am installing opencv and opencv-contrib in my ubuntu pc. I installed it in both python 2 and 3. I have successfully installed it. However when I doing "import cv2" it immediately produce "segmentation fault (core dumped)". It happens in both python 2 and python 3. So how can I fix this problem? Here is my full problem [see problem](https://github.com/opencv/opencv/issues/9568) -Thank you-
Viewing all 4615 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>