Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
readseq.cpp
Package: Opencv-source-code.rar [view]
Upload User: banwdc
Upload Date: 2016-06-25
Package Size: 2871k
Code Size: 2k
Category:
OpenCV
Development Platform:
Visual C++
- #include <stdio.h>
- #include "cxcore.h"
- int main( int argc, char** argv )
- {
- CvFileStorage* fs = cvOpenFileStorage( "points.yml", 0, CV_STORAGE_READ );
- CvStringHashNode* x_key = cvGetHashedNode( fs, "x", -1, 1 );
- CvStringHashNode* y_key = cvGetHashedNode( fs, "y", -1, 1 );
- CvFileNode* points = cvGetFileNodeByName( fs, 0, "points" );
- if( CV_NODE_IS_SEQ(points->tag) )
- {
- CvSeq* seq = points->data.seq;
- int i, total = seq->total;
- CvSeqReader reader;
- cvStartReadSeq( seq, &reader, 0 );
- for( i = 0; i < total; i++ )
- {
- CvFileNode* pt = (CvFileNode*)reader.ptr;
- #if 1 /* 快变量 */
- CvFileNode* xnode = cvGetFileNode( fs, pt, x_key, 0 );
- CvFileNode* ynode = cvGetFileNode( fs, pt, y_key, 0 );
- assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
- ynode && CV_NODE_IS_INT(ynode->tag));
- int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
- int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
- #elif 1 /* 慢变量:不使用x值与y值 */
- CvFileNode* xnode = cvGetFileNodeByName( fs, pt, "x" );
- CvFileNode* ynode = cvGetFileNodeByName( fs, pt, "y" );
- assert( xnode && CV_NODE_IS_INT(xnode->tag) &&
- ynode && CV_NODE_IS_INT(ynode->tag));
- int x = xnode->data.i; // or x = cvReadInt( xnode, 0 );
- int y = ynode->data.i; // or y = cvReadInt( ynode, 0 );
- #else /* 最慢的可以轻松使用的变量 */
- int x = cvReadIntByName( fs, pt, "x", 0 /* default value */ );
- int y = cvReadIntByName( fs, pt, "y", 0 /* default value */ );
- #endif
- CV_NEXT_SEQ_ELEM( seq->elem_size, reader );
- printf("%d: (%d, %d)n", i, x, y );
- }
- }
- cvReleaseFileStorage( &fs );
- return 0;
- }