mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -216,8 +216,6 @@ for i in range(len(objpoints)):
|
||||
|
||||
print( "total error: {}".format(mean_error/len(objpoints)) )
|
||||
@endcode
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -158,9 +158,6 @@ side. That meeting point is the epipole.
|
||||
|
||||
For better results, images with good resolution and many non-planar points should be used.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -119,9 +119,3 @@ And look at the result below:
|
||||
|
||||
If you are interested in graphics, augmented reality etc, you can use OpenGL to render more
|
||||
complicated figures.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -51,23 +51,6 @@ You can modify the pixel values the same way.
|
||||
Numpy is an optimized library for fast array calculations. So simply accessing each and every pixel
|
||||
value and modifying it will be very slow and it is discouraged.
|
||||
|
||||
@note The above method is normally used for selecting a region of an array, say the first 5 rows
|
||||
and last 3 columns. For individual pixel access, the Numpy array methods, array.item() and
|
||||
array.itemset() are considered better. They always return a scalar, however, so if you want to access
|
||||
all the B,G,R values, you will need to call array.item() separately for each value.
|
||||
|
||||
Better pixel accessing and editing method :
|
||||
@code{.py}
|
||||
# accessing RED value
|
||||
>>> img.item(10,10,2)
|
||||
59
|
||||
|
||||
# modifying RED value
|
||||
>>> img.itemset((10,10,2),100)
|
||||
>>> img.item(10,10,2)
|
||||
100
|
||||
@endcode
|
||||
|
||||
Accessing Image Properties
|
||||
--------------------------
|
||||
|
||||
@@ -195,9 +178,3 @@ See the result below. (Image is displayed with matplotlib. So RED and BLUE chann
|
||||
interchanged):
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -110,9 +110,6 @@ img2_fg.
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -163,6 +163,3 @@ Additional Resources
|
||||
2. Scipy Lecture Notes - [Advanced
|
||||
Numpy](http://scipy-lectures.github.io/advanced/advanced_numpy/index.html#advanced-numpy)
|
||||
3. [Timing and Profiling in IPython](http://pynash.org/2013/03/06/timing-and-profiling/)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -138,6 +138,3 @@ Additional Resources
|
||||
2. Edward Rosten, Reid Porter, and Tom Drummond, "Faster and better: a machine learning approach to
|
||||
corner detection" in IEEE Trans. Pattern Analysis and Machine Intelligence, 2010, vol 32, pp.
|
||||
105-119.
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -102,9 +102,3 @@ plt.imshow(img3, 'gray'),plt.show()
|
||||
See the result below. Object is marked in white color in cluttered image:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -81,9 +81,3 @@ or do whatever you want.
|
||||
|
||||
So in this module, we are looking to different algorithms in OpenCV to find features, describe them,
|
||||
match them etc.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -209,9 +209,3 @@ plt.imshow(img3,),plt.show()
|
||||
See the result below:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -93,6 +93,3 @@ Additional Resources
|
||||
|
||||
-# Ethan Rublee, Vincent Rabaud, Kurt Konolige, Gary R. Bradski: ORB: An efficient alternative to
|
||||
SIFT or SURF. ICCV 2011: 2564-2571.
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -67,9 +67,3 @@ See the result below:
|
||||

|
||||
|
||||
This function is more appropriate for tracking. We will see that when its time comes.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -160,9 +160,3 @@ Here kp will be a list of keypoints and des is a numpy array of shape
|
||||
|
||||
So we got keypoints, descriptors etc. Now we want to see how to match keypoints in different images.
|
||||
That we will learn in coming chapters.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -155,9 +155,3 @@ Finally we check the descriptor size and change it to 128 if it is only 64-dim.
|
||||
(47, 128)
|
||||
@endcode
|
||||
Remaining part is matching which we will do in another chapter.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -101,8 +101,6 @@ while(1):
|
||||
|
||||
cv.destroyAllWindows()
|
||||
@endcode
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -152,9 +152,3 @@ cap.release()
|
||||
out.release()
|
||||
cv.destroyAllWindows()
|
||||
@endcode
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -103,9 +103,6 @@ Now you take [H-10, 100,100] and [H+10, 255, 255] as the lower bound and upper b
|
||||
from this method, you can use any image editing tools like GIMP or any online converters to find
|
||||
these values, but don't forget to adjust the HSV ranges.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
-6
@@ -199,9 +199,3 @@ righty = int(((cols-x)*vy/vx)+y)
|
||||
cv.line(img,(cols-1,righty),(0,lefty),(0,255,0),2)
|
||||
@endcode
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -114,9 +114,6 @@ For eg, if I apply it to an Indian map, I get the following result :
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -88,9 +88,3 @@ the contour array (drawn in blue color). First image shows points I got with cv.
|
||||
much memory it saves!!!
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-6
@@ -212,9 +212,3 @@ array([[[ 7, -1, 1, -1],
|
||||
[ 8, 0, -1, -1],
|
||||
[-1, 7, -1, -1]]])
|
||||
@endcode
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -124,9 +124,6 @@ See, even image rotation doesn't affect much on this comparison.
|
||||
moments invariant to translation, rotation and scale. Seventh one is skew-invariant. Those values
|
||||
can be found using **cv.HuMoments()** function.
|
||||
|
||||
Additional Resources
|
||||
====================
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -150,6 +150,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# Details about the [bilateral filtering](http://people.csail.mit.edu/sparis/bf_course/)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -163,6 +163,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# "Computer Vision: Algorithms and Applications", Richard Szeliski
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -146,9 +146,6 @@ mark the rectangle area in mask image with 2-pixel or 3-pixel (probable backgrou
|
||||
mark our sure_foreground with 1-pixel as we did in second example. Then directly apply the grabCut
|
||||
function with mask mode.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -103,9 +103,3 @@ plt.show()
|
||||
Check the result below:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -125,9 +125,3 @@ output of that code for the same image as above:
|
||||
|
||||
You can clearly see in the histogram what colors are present, blue is there, yellow is there, and
|
||||
some white due to chessboard is there. Nice !!!
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -123,6 +123,3 @@ Additional Resources
|
||||
|
||||
-# "Indexing via color histograms", Swain, Michael J. , Third international conference on computer
|
||||
vision,1990.
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -197,6 +197,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# [Cambridge in Color website](http://www.cambridgeincolour.com/tutorials/histograms1.htm)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -151,6 +151,3 @@ Also check these SOF questions regarding contrast adjustment:
|
||||
C?](http://stackoverflow.com/questions/10549245/how-can-i-adjust-contrast-in-opencv-in-c)
|
||||
4. [How do I equalize contrast & brightness of images using
|
||||
opencv?](http://stackoverflow.com/questions/10561222/how-do-i-equalize-contrast-brightness-of-images-using-opencv)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -45,9 +45,3 @@ cv.destroyAllWindows()
|
||||
Result is shown below:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -103,6 +103,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# [Hough Transform on Wikipedia](http://en.wikipedia.org/wiki/Hough_transform)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -152,6 +152,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# [Morphological Operations](http://homepages.inf.ed.ac.uk/rbf/HIPR2/morops.htm) at HIPR2
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -139,6 +139,3 @@ Additional Resources
|
||||
--------------------
|
||||
|
||||
-# [Image Blending](http://pages.cs.wisc.edu/~csverma/CS766_09/ImageMosaic/imagemosaic.html)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -132,9 +132,3 @@ cv.imwrite('res.png',img_rgb)
|
||||
Result:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -291,6 +291,3 @@ Additional Resources
|
||||
Theory](http://cns-alumni.bu.edu/~slehar/fourier/fourier.html) by Steven Lehar
|
||||
2. [Fourier Transform](http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm) at HIPR
|
||||
3. [What does frequency domain denote in case of images?](http://dsp.stackexchange.com/q/1637/818)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -186,9 +186,3 @@ cv.destroyAllWindows()
|
||||
See the result below for K=8:
|
||||
|
||||

|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
-3
@@ -80,6 +80,3 @@ Additional Resources
|
||||
|
||||
-# [Machine Learning Course](https://www.coursera.org/course/ml), Video lectures by Prof. Andrew Ng
|
||||
(Some of the images are taken from this)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -147,6 +147,3 @@ Additional Resources
|
||||
recommended to visit. Our test image is generated from this link)
|
||||
2. [Online course at coursera](https://www.coursera.org/course/images) (First image taken from
|
||||
here)
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
@@ -240,9 +240,6 @@ make doxygen
|
||||
@endcode
|
||||
Then open opencv/build/doc/doxygen/html/index.html and bookmark it in the browser.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -119,9 +119,6 @@ Building OpenCV from source
|
||||
@note We have installed with no other support like TBB, Eigen, Qt, Documentation etc. It would be
|
||||
difficult to explain it here. A more detailed video will be added soon or you can just hack around.
|
||||
|
||||
Additional Resources
|
||||
--------------------
|
||||
|
||||
Exercises
|
||||
---------
|
||||
|
||||
|
||||
@@ -21,15 +21,22 @@ In this tutorial you will learn how to:
|
||||
- Draw a **circle** by using the OpenCV function **circle()**
|
||||
- Draw a **filled polygon** by using the OpenCV function **fillPoly()**
|
||||
|
||||
@add_toggle_cpp
|
||||
OpenCV Theory
|
||||
-------------
|
||||
|
||||
@add_toggle_cpp
|
||||
For this tutorial, we will heavily use two structures: @ref cv::Point and @ref cv::Scalar :
|
||||
@end_toggle
|
||||
@add_toggle_java
|
||||
For this tutorial, we will heavily use two structures: @ref cv::Point and @ref cv::Scalar :
|
||||
@end_toggle
|
||||
@add_toggle_python
|
||||
For this tutorial, we will heavily use tuples in Python instead of @ref cv::Point and @ref cv::Scalar :
|
||||
@end_toggle
|
||||
|
||||
### Point
|
||||
|
||||
It represents a 2D point, specified by its image coordinates \f$x\f$ and \f$y\f$. We can define it as:
|
||||
@add_toggle_cpp
|
||||
@code{.cpp}
|
||||
Point pt;
|
||||
pt.x = 10;
|
||||
@@ -39,28 +46,8 @@ or
|
||||
@code{.cpp}
|
||||
Point pt = Point(10, 8);
|
||||
@endcode
|
||||
### Scalar
|
||||
|
||||
- Represents a 4-element vector. The type Scalar is widely used in OpenCV for passing pixel
|
||||
values.
|
||||
- In this tutorial, we will use it extensively to represent BGR color values (3 parameters). It is
|
||||
not necessary to define the last argument if it is not going to be used.
|
||||
- Let's see an example, if we are asked for a color argument and we give:
|
||||
@code{.cpp}
|
||||
Scalar( a, b, c )
|
||||
@endcode
|
||||
We would be defining a BGR color such as: *Blue = a*, *Green = b* and *Red = c*
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_java
|
||||
OpenCV Theory
|
||||
-------------
|
||||
|
||||
For this tutorial, we will heavily use two structures: @ref cv::Point and @ref cv::Scalar :
|
||||
|
||||
### Point
|
||||
|
||||
It represents a 2D point, specified by its image coordinates \f$x\f$ and \f$y\f$. We can define it as:
|
||||
@code{.java}
|
||||
Point pt = new Point();
|
||||
pt.x = 10;
|
||||
@@ -70,6 +57,12 @@ or
|
||||
@code{.java}
|
||||
Point pt = new Point(10, 8);
|
||||
@endcode
|
||||
@end_toggle
|
||||
@add_toggle_python
|
||||
@code{.python}
|
||||
pt = (10, 0) # x = 10, y = 0
|
||||
@endcode
|
||||
@end_toggle
|
||||
### Scalar
|
||||
|
||||
- Represents a 4-element vector. The type Scalar is widely used in OpenCV for passing pixel
|
||||
@@ -77,11 +70,22 @@ Point pt = new Point(10, 8);
|
||||
- In this tutorial, we will use it extensively to represent BGR color values (3 parameters). It is
|
||||
not necessary to define the last argument if it is not going to be used.
|
||||
- Let's see an example, if we are asked for a color argument and we give:
|
||||
@add_toggle_cpp
|
||||
@code{.cpp}
|
||||
Scalar( a, b, c )
|
||||
@endcode
|
||||
@end_toggle
|
||||
@add_toggle_java
|
||||
@code{.java}
|
||||
Scalar( a, b, c )
|
||||
@endcode
|
||||
We would be defining a BGR color such as: *Blue = a*, *Green = b* and *Red = c*
|
||||
@end_toggle
|
||||
@add_toggle_python
|
||||
@code{.python}
|
||||
( a, b, c )
|
||||
@endcode
|
||||
@end_toggle
|
||||
We would be defining a BGR color such as: *Blue = a*, *Green = b* and *Red = c*
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
@@ -393,7 +393,7 @@ There are multiple less popular frameworks which can be used to read and write v
|
||||
|
||||
| Option | Default | Description |
|
||||
| ------ | ------- | ----------- |
|
||||
| `WITH_1394` | _ON_ | [IIDC IEEE1394](https://en.wikipedia.org/wiki/IEEE_1394#IIDC) support using DC1394 library |
|
||||
| `WITH_1394` | _OFF_ | [IIDC IEEE1394](https://en.wikipedia.org/wiki/IEEE_1394#IIDC) support using DC1394 library |
|
||||
| `WITH_OPENNI` | _OFF_ | [OpenNI](https://en.wikipedia.org/wiki/OpenNI) can be used to capture data from depth-sensing cameras. Deprecated. |
|
||||
| `WITH_OPENNI2` | _OFF_ | [OpenNI2](https://structure.io/openni) can be used to capture data from depth-sensing cameras. |
|
||||
| `WITH_PVAPI` | _OFF_ | [PVAPI](https://www.alliedvision.com/en/support/software-downloads.html) is legacy SDK for Prosilica GigE cameras. Deprecated. |
|
||||
@@ -455,6 +455,8 @@ OpenCV relies on various GUI libraries for window drawing.
|
||||
| `WITH_WIN32UI` | _ON_ | Windows | [WinAPI](https://en.wikipedia.org/wiki/Windows_API) is a standard GUI API in Windows. |
|
||||
| N/A | _ON_ | macOS | [Cocoa](https://en.wikipedia.org/wiki/Cocoa_(API)) is a framework used in macOS. |
|
||||
| `WITH_QT` | _OFF_ | Cross-platform | [Qt](https://en.wikipedia.org/wiki/Qt_(software)) is a cross-platform GUI framework. |
|
||||
| `WITH_FRAMEBUFFER` | _OFF_ | Linux | Experimental backend using [Linux framebuffer](https://en.wikipedia.org/wiki/Linux_framebuffer). Have limited functionality but does not require dependencies. |
|
||||
| `WITH_FRAMEBUFFER_XVFB` | _OFF_ | Linux | Enables special output mode of the FRAMEBUFFER backend compatible with [xvfb](https://en.wikipedia.org/wiki/Xvfb) tool. Requires some X11 headers. |
|
||||
|
||||
@note OpenCV compiled with Qt support enables advanced _highgui_ interface, see @ref highgui_qt for details.
|
||||
|
||||
|
||||
@@ -329,6 +329,9 @@ Some external dependencies can be detached into a dynamic library, which will be
|
||||
|------|------|---------|-------------|
|
||||
| OPENCV_LEGACY_WAITKEY | non-null | | switch `waitKey` return result (default behavior: `return code & 0xff` (or -1), legacy behavior: `return code`) |
|
||||
| $XDG_RUNTIME_DIR | | | Wayland backend specific - create shared memory-mapped file for interprocess communication (named `opencv-shared-??????`) |
|
||||
| OPENCV_HIGHGUI_FB_MODE | string | `FB` | Selects output mode for the framebuffer backend (`FB` - regular frambuffer, `EMU` - emulation, perform internal checks but does nothing, `XVFB` - compatible with _xvfb_ virtual frambuffer) |
|
||||
| OPENCV_HIGHGUI_FB_DEVICE | file path | | Path to frambuffer device to use (will be checked first) |
|
||||
| FRAMEBUFFER | file path | `/dev/fb0` | Same as OPENCV_HIGHGUI_FB_DEVICE, commonly used variable for the same purpose (will be checked second) |
|
||||
|
||||
|
||||
## imgproc
|
||||
|
||||
@@ -23,18 +23,36 @@ In this tutorial you will learn how to:
|
||||
|
||||
Code
|
||||
----
|
||||
@add_toggle_cpp
|
||||
This tutorial's code is shown in the lines below. You can download it from [here](https://github.com/opencv/opencv/tree/5.x/samples/cpp/stitching.cpp).
|
||||
|
||||
This tutorial code's is shown lines below. You can also download it from
|
||||
[here](https://github.com/opencv/opencv/tree/5.x/samples/cpp/stitching.cpp).
|
||||
Note: The C++ version includes additional options such as image division (--d3) and more detailed error handling, which are not present in the Python example.
|
||||
|
||||
@include samples/cpp/snippets/stitching.cpp
|
||||
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
This tutorial's code is shown in the lines below. You can download it from [here](https://github.com/opencv/opencv/blob/5.x/samples/python/stitching.py).
|
||||
|
||||
Note: The C++ version includes additional options such as image division (--d3) and more detailed error handling, which are not present in the Python example.
|
||||
|
||||
@include samples/python/snippets/stitching.py
|
||||
|
||||
@end_toggle
|
||||
|
||||
Explanation
|
||||
-----------
|
||||
|
||||
The most important code part is:
|
||||
|
||||
@add_toggle_cpp
|
||||
@snippet cpp/snippets/stitching.cpp stitching
|
||||
@end_toggle
|
||||
|
||||
@add_toggle_python
|
||||
@snippet python/snippets/stitching.py stitching
|
||||
@end_toggle
|
||||
|
||||
A new instance of stitcher is created and the @ref cv::Stitcher::stitch will
|
||||
do all the hard work.
|
||||
|
||||
Reference in New Issue
Block a user