GithubHelp home page GithubHelp logo

spmallick / learnopencv Goto Github PK

View Code? Open in Web Editor NEW
20.4K 886.0 11.5K 2.66 GB

Learn OpenCV : C++ and Python Examples

Home Page: https://www.learnopencv.com/

C++ 0.22% Python 0.78% QMake 0.01% Jupyter Notebook 98.19% C 0.24% CMake 0.02% Shell 0.02% Makefile 0.01% HTML 0.01% Java 0.44% M4 0.01% MATLAB 0.01% Batchfile 0.01% Dockerfile 0.01% AIDL 0.01% PowerShell 0.01% Cuda 0.05% C# 0.01% Cython 0.01% JavaScript 0.01%
computer-vision machine-learning ai deep-learning deep-neural-networks deeplearning computervision opencv opencv-python opencv-library

learnopencv's Issues

tracker-issue

I got a problem in the tracker example it could not find any of the trackers that implemented like (cv2.TrackerBoosting_create()) is it for the opencv version ?? i have installed 3.4.0.12 version

KerasMLP-MNIST - SSH error when downloading MNIST with KERAS

Environnement :
-MAC OSX
-PyCharm Community Edition 2017.2
-Python 3.6

Code raising the error in keras-mlp-mnist.ipynb :
from keras.datasets import mnist

Error raised :
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

Complete log :

Using TensorFlow backend.
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)
2017-11-06 18:20:25.647592: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.npz
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 814, in init
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/data_utils.py", line 220, in get_file
urlretrieve(origin, fpath, dl_progress)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 248, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/damien/Documents/Dev/Python/keras-mlp-mnist/Code.py", line 27, in
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/datasets/mnist.py", line 17, in load_data
file_hash='8a61469f7ea1b51cbae51d4f78837e45')
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/data_utils.py", line 222, in get_file
raise Exception(error_msg.format(origin, e.errno, e.reason))
Exception: URL fetch failure on https://s3.amazonaws.com/img-datasets/mnist.npz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)

Process finished with exit code 1

how do i detect only one class ?

I want to detect only one class(person) in my image. like, I want to count the number of persons in my image. how should i proceed.

FaceAvereage - faces not morphing?

When I run python faceAverage.py I get this rather confused output.

faceaverage

Running the faceMorph.py does seem to work.

I'm running Python 2.7.6 on Ubuntu 14.04.4. Any idea what's going wrong?

Pedestrian counter with two of lines

Hi,

I'm interested on Pedestrian Counter project with openCV. One of the sample source code that i've found is shared by @anandsinghkunwar on git hub https://github.com/anandsinghkunwar/pedestrian-counter

But it quite confusing on returning of function line1(x,y) and line2(x,y). I want to change the default lines to be transverse over the frame to be like this:

    cv2.line(frame, (0,100), (500,100), (255, 0, 0), 2)
    cv2.line(frame, (0,200), (500,200), (255, 0, 0), 2)

Anybody can help me to tuning the function line1(x,y) and line2(x,y)

Undefined reference to cv::Subdiv2D::getTriangleList - faceAverage.cpp

Hi, i'm developing an android application about Average Face.

I have a cpp file based on faceAverage.cpp (https://github.com/spmallick/learnopencv/blob/master/FaceAverage/faceAverage.cpp)
but when i compile the code, i get this error:
Error:(154) undefined reference to 'cv::Subdiv2D::getTriangleList(std::__ndk1::vector<cv::Vec<float, 6>, std::__ndk1::allocator<cv::Vec<float, 6> > >&) const'

The error occur inside the calculateDelaunayTriangles function, precisely at this statement: subdiv.getTriangleList(triangleList)

The calculateDelaunayTriangles function is exactly the same as in faceAverage.cpp

How can i fix the error?

How to generate the facial landmark text file?

I see you have used txt files for image facial coordianates. How did you generate those? I am not able to iterate over the predictor function of the dlib? Can you please share the code snippet?

What is the mapIdx for hand model?

Hello
I would like to extract hand keypoints in the images. So, In the multi-person-openpose.py file, how can I define the value for mapIdx of hand?
Please help me.

Pb in the AlphaBlending code

Hello,

At this lines :
Mat alpha = Mat::zeros(foreGroundImage.size(), CV_8UC3);
merge(alphaChannels, alpha);

The code crashed on merge. The alpha Mat is not created.

Could you help ?
thx

what is the dimensions of 3D model?

In the headpose.py file, what means 3D model points ? How to calc it?

3D model points.

model_points = np.array([
(0.0, 0.0, 0.0), # Nose tip
(0.0, -330.0, -65.0), # Chin
(-225.0, 170.0, -135.0), # Left eye left corner
(225.0, 170.0, -135.0), # Right eye right corne
(-150.0, -150.0, -125.0), # Left Mouth corner
(150.0, -150.0, -125.0) # Right mouth corner

                    ])

Filled Circles

Wrt to the blob detector. Is there a possibility to draw the bounding circles as filled instead of the current state?

Incorrect output when using morph

Thanks for that nice example.
I want to use your code with automatically found landmarks (using dlib's landmark detector). So how can I get the correct assignment of the rectangles generated with delauny triangulation? Because it seems that when I just take the given order it is not correct. Means the result does not look like a face (but like rectangles on a face). Hope you can understand what I mean. Here's some pseudo code of what I'm doing:

  • get landmarks on face 1using dlib
  • get landmarks on face 2 using dlib
  • delauny triangulation on both
  • pixel correspondence of morphed image (use rectangles from face 2)
  • for(rectangles from face 1) {
  • get affine transformation(rectangleFace1, rectangleFace2)
  • warp triangles
  • }
    By the way I want to completely override the rectangles from the first image with the rectangles from the second image. So a kind of simply transforming the rectangles from second image (in the form of the first image).

Please help, thanks in advance.
Best regards
Patricia

failed to load video

SystemExit Traceback (most recent call last)
in ()
53 if not success:
54 print('Failed to read video')
---> 55 sys.exit(1)
56
57 ## Select boxes

SystemExit: 1

Compile error on ObjectDetection-YOLO

object_detection_yolo.cpp:40: undefined reference to cv::CommandLineParser::CommandLineParser(int, char const* const*, cv::String const&)'

ObjectDetection-YOLO

I think there's some Cmake options missed out when building opencv from source.

My compiler commands:

g++ -std=c++0x -ggdb `pkg-config --cflags --libs /usr/local/lib/pkgconfig/opencv.pc` object_detection_yolo.cpp -o object.out

Here's my opencv.pc details:

# Package Information for pkg-config

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 3.4.2
Libs: -L${exec_prefix}/lib -lopencv_videostab -lopencv_stitching -lopencv_superres -lopencv_fuzzy -lopencv_hfs -lopencv_dnn_objdetect -lopencv_rgbd -lopencv_dpm -lopencv_optflow -lopencv_ximgproc -lopencv_ccalib -lopencv_structured_light -lopencv_xphoto -lopencv_saliency -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_line_descriptor -lopencv_stereo -lopencv_img_hash -lopencv_xobjdetect -lopencv_surface_matching -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_phase_unwrapping -lopencv_bioinspired -lopencv_reg -lopencv_aruco -lopencv_face -lopencv_photo -lopencv_objdetect -lopencv_bgsegm -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_flann -lopencv_freetype -lopencv_imgproc -lopencv_core
Libs.private: -ldl -lm -lpthread -lrt
Cflags: -I${includedir_old} -I${includedir_new}

Getting build errors when building object detection example

I am trying to build the object detection example on a raspberry pi 3 running raspbian. My commandline is as follows.
g++ -ggdb pkg-config --cflags --libs /usr/local/lib/pkgconfig/opencv.pc obd.cpp -o obd.out
I am getting the following output.
^
obd.cpp:85:31: note: candidates are:
In file included from obd.cpp:5:0:
/usr/include/c++/4.8/fstream:467:7: note: std::basic_ifstream<_CharT, _Traits>::
basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Trait
s = std::char_traits; std::ios_base::openmode = std::_Ios_Openmode]
basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
^
/usr/include/c++/4.8/fstream:467:7: note: no known conversion for argument 1 f
rom ‘std::string {aka std::basic_string}’ to ‘const char*’
/usr/include/c++/4.8/fstream:453:7: note: std::basic_ifstream<_CharT, _Traits>::
basic_ifstream() [with _CharT = char; _Traits = std::char_traits]
basic_ifstream() : __istream_type(), _M_filebuf()
^
/usr/include/c++/4.8/fstream:453:7: note: candidate expects 0 arguments, 1 pro
vided
/usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream::basic_ifst
ream(const std::basic_ifstream&)
class basic_ifstream : public basic_istream<_CharT, _Traits>
^
/usr/include/c++/4.8/fstream:427:11: note: no known conversion for argument 1
from ‘std::string {aka std::basic_string}’ to ‘const std::basic_ifstream&’

What do I need to do to fix this?

Gait Analysis

One can also use open pose estimation for gait analysis. Gait energy image is also a good technique.

Getting error while running reconstructFace.py

Reading model file pcaParams.yml
Traceback (most recent call last):
File "/home/vaibhav/PycharmProjects/reconstructFace.py", line 51, in
sz = (int(sz[0, 0]), int(sz[1, 0]), int(sz[2, 0]))
TypeError: 'NoneType' object has no attribute 'getitem'

iteration through a folder.

I am trying Object deection with yolo.
can you you write a script so that i can iterate through a folder with images at a time

detecting a single class.

I want to detect only one class person . I want to count the number of person detected.
It would be a great help.

wrong fps in tracker.cpp

Tracker.cpp gives fps values only for the tracker->update, not for video.read() + tracker->update.

Better start with timer = (double)getTickCount(); just before the while(video.read) loop, and again at the end of that loop. Remove the timer from the first line in the loop.
This gives reasonable fps.

YOLO detection false negative

Hello.
I launched yolo detection with video stream(IP-camera).
Picture:
image
There's two cars, but algorithm detected only one.
Can I tune program to fix it? Help me plz

advice for face morph

Hello! Thanks for this amazing repo, so much to learn!!
I am writing a program based on the facemorph code. It works really nicely except one detail that I can't solve yet, but I feel it must be something really simple. The warped triangles seem to overlap by 1 pixel, and their pixel colour then wraps around 255 (as I assume) and I get these lines in between the pieces (view attached image).
Any idea what would be a simple solution to that? Greatly appreciate you help!
Thanks
screen shot 2017-03-18 at 14 11 00

YOLO detection error

when I run object_detection_yolo.py, I got this error

user@user:~/Desktop/YOLOOpenCV$ python3 object_detection_yolo.py
OpenCV(3.4.1) Error: Parsing error (Unknown layer type: shortcut) in ReadDarknetFromCfgFile, file /io/opencv/modules/dnn/src/darknet/darknet_io.cpp, line 503
Traceback (most recent call last):
File "object_detection_yolo.py", line 33, in
net = cv.dnn.readNetFromDarknet(modelConfiguration, modelWeights)
cv2.error: OpenCV(3.4.1) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:503: error: (-212) Unknown layer type: shortcut in function ReadDarknetFromCfgFile

How can I solve this?

.jpg.txt?

how did you convert the jpg files to a txt file, and why do you do so?

people counter

Hi sir am new to opencv i want the code for people counter (counting the people per hour,day,month)and stored in somewhere like database.

nothing happens when executing the code(Eigenface)

Hi there, I'm new in the field and have problem with getting result of executing Eigenface code, here is all i got when i run Eigenface.py
Reading images from F:\learnopencv-master\EigenFace\images...

I'm using winpython-3.4.2.2.amd64

Any idea will be helpful...! Thank you

ConvexHull Error compiling..

xample.cpp: In function ‘int main(int, char**)’:
example.cpp:48:22: error: ‘>>’ should be ‘> >’ within a nested template argument list
   vector<vector<Point>> hull(contours.size());

the source code should have a space between the >> or it assumes bit shift..

i.e. vector< vector<Point> > hull(contours.size());

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.