I spent two days to test the program as one of my friend want to save frames in video file.
I find that opencv work on video things by FFMPEG library.So before you install opencv ,you mush check if you have install ffmpeg and libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev.
After that ,you can recompile the opencv :
./configure
make
sudo make install
If when you do ./configure ,you can see "ffmpeg yes", then it said opencv can work on ffmpeg..
When I do recompile the source code of opencv , I find something interesting.
Afger configure,I find opencv can find ffmpeg..but it still can not read and write video files.
but after I change something in highgui's source code and do recompile again, it's working..
I think maybe that's because if you dont change anything in the source code .It does not refresh the library...
More information about opencv and Ubuntu
http://dircweb.king.ac.uk/reason/opencv_cvs.php
Showing posts with label imageProcess. Show all posts
Showing posts with label imageProcess. Show all posts
Wednesday, October 8, 2008
Thursday, June 5, 2008
Image coordinate and World coordinate
If you want to show a world coordinate image by OpenCv or Matlab, you need to know the difference between Image coordinate system and the world coordinate system.
The main difference is the original point, which is uper-left in image coordinate and bottom-middle in IPM (Inverse projection mapping)world coordinate.
The main difference is the original point, which is uper-left in image coordinate and bottom-middle in IPM (Inverse projection mapping)world coordinate.
Wednesday, May 28, 2008
How to do adaptive threshold?
- Convolve the image i.e. the mean or median. imageCon=imfilter(imageOri) or medfilter()
- Subtract the original from the convolved image. imageDif= imageOri-imageCon;
- Threshold the difference image with C(constant). imageThr=imageDif-C;
- Invert the thresholded image. imageEnd=imcomplement(imageThr);
Matlab code:"http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8647"
How to manage the image in memory?
Both of cvLoadImage and cvCreateImage would allocate a new memory space for image..
After you use that two function, you need cvReleaseImage funtion to release that.
Before you release them , a good habit is to use if(image) to detect if it's NULL..
Also..new and delete is allocating and release function in cpp.Please remember that new function will return a pointer..so you can't use it like this : int a =new int;
for example:
int* a=new int;
delete a;
for array:
int *a=new int[100]
delete[] a;
After you use that two function, you need cvReleaseImage funtion to release that.
Before you release them , a good habit is to use if(image) to detect if it's NULL..
Also..new and delete is allocating and release function in cpp.Please remember that new function will return a pointer..so you can't use it like this : int a =new int;
for example:
int* a=new int;
delete a;
for array:
int *a=new int[100]
delete[] a;
Monday, May 26, 2008
Memory cost of images
see more:"http://www.scantips.com/basics1d.html"
Large images consume large memory and make our computers struggle. Memory cost for an image is computed from the image size.
For a 6x4 inch image at 150 dpi, the image size is calculated as:
(6 inches × 150 dpi) × (4 inches × 150 dpi) = 900 × 600 pixels
900 × 600 pixels is 900 × 600 = 540,000 pixels.
The memory cost for this RGB color image is:
900 × 600 × 3 = 1.6 million bytes.
The last "× 3" is for 3 bytes of RGB color information per pixel for 24 bit color (3 RGB values per pixel, one 8-bit byte for each RGB value, which totals 24 bit color).
Different color modes have different size values, as shown below:
| Image Type | Bytes per pixel | |
| 1 bit Line art | 1/8 byte per pixel (1 bit per pixel, 8 bits per byte) | |
| 8 bit Grayscale | 1 byte per pixel | |
| 16 bit Grayscale | 2 bytes per pixel | |
| 24 bit RGB | 3 bytes per pixel Most common for photos, for example JPG | |
| 32 bit CMYK | 4 bytes per pixel For Prepress | |
| 48 bit RGB | 6 bytes per pixel |
Subscribe to:
Posts (Atom)