Adds OpenCV tips

This commit is contained in:
2012-10-29 13:16:16 +01:00
parent 926b4aae82
commit 27b3ffaf33
2 changed files with 69 additions and 0 deletions

68
opencv.md Normal file
View File

@@ -0,0 +1,68 @@
# OpenCV
Memos and Tips about the OpenCV library.
## In C/C++:
### Placing a pointer to the beginning of pixel in an image:
Can be used to naviguate through pixels easily (and more efficiently than some openCV functions).
```C
char *pImage = iplImage->ImageData
```
### Short review of the IplImage structure:
Whats really needed to work with an Image
```C
* IplImage struct {
depth # Number of channels (gray level, color, . . .)
sizeX
sizeY
* ImageData } #Pixels of the image
...}
```
### Simple tips for Image Processing optimization in C:
An image is stored in a memory a a long line (n*m size)
Always go __trough the buffer way__, and not the opposite!
```C
for (i in nb_lines):
for (j in nb_cols):
//do stuff
}
}
```
and
```C
for (j in nb_cols):
for (i in nb_lines):
//do stuff
}
}
```
are different ! **The second one is 10% faster than the other !**
##In Python :
Error on compiling OpenCV with Python bindings:
If you get this error when trying to compile OpenCV in Linux
```bash
Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) in cmake
```
Simply try installing python-dev packages.
```bash
$ sudo apt-get install python-dev
```
It should solve the problem.

View File

@@ -12,6 +12,7 @@ $ svn cp trunk -> new_branch
```bash
$ svn update
```
__**NOTE:** The command is an update and not a commit, as this is the server who performed the operation!__
Youre done!