DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
True Drop Box
FTP/SFTP Hosting
Group Account
Team Anywhere
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Cloud-to-Cloud Backup
|
DVR/Camera Backup
FTP, Email & Web Service
FTP/SFTP Hosting
|
Email Hosting
|
Web Hosting
|
Webcam Hosting
Cloud Surveillance & Remote Desktop
Team Anywhere
|
Access Remote PC
|
Cloud Surveillance
|
Virtual CCTV NVR
Quick Links
Security and Privacy
Customer Support
Service Manual
Use Cases
Group Account
Online Help
Support Forum
Contact Us
About DriveHQ
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
Cloud Surveillance & Remote Desktop
Team Anywhere (Remote Desktop Service)
CameraFTP Cloud Surveillance
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
CameraFTP Software & Apps
DriveHQ Team Anywhere
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
CameraFTP Cloud Recording Service Plans
DriveHQ Team Anywhere Service Plans
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Sign up
Help
Support Home
Support Forum
Service Manual
Online Help
Tutorial videos
Remote Support
About DriveHQ
Contact
CameraFTP Support
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
//============================================================================= #include "correlator.h" #include "bwImage.h" #include "rgbImage.h" #include
#include
#include "xwindow.c" correlator::correlator( const movieIO &src, bool visible, bool clearFrames ) { ::correlator( src.getWidth(), src.getHeight(), visible, clearFrames ); rgbImage *rgbBuf; for ( int i=0; i
height ? width : height; int visualAttr[] = { GLX_RGBA,// GLX_DOUBLEBUFFER, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 0, GLX_DEPTH_SIZE, 0, GLX_ACCUM_RED_SIZE, 0, GLX_ACCUM_GREEN_SIZE, 0, GLX_ACCUM_BLUE_SIZE, 0, GLX_AUX_BUFFERS, 0, GLX_SAMPLES_SGIS, 0, None }; createWindowAndContext( &dpy_, &window_, &ctx_, 50, 0, viewportSize, viewportSize, GL_FALSE, NULL, visualAttr, NULL, "Image Correlation" ); localCompBuf_ = (unsigned char *)malloc( viewportSize*viewportSize*3* sizeof(unsigned char) ); if ( visible ) { glViewport( 0, 0, viewportSize, viewportSize ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( 0, viewportSize, 0, viewportSize, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL ); if ( !clearFrames_ ) glClear( GL_COLOR_BUFFER_BIT ); } } correlator::~correlator() { } bool correlator::addImageFrame( int idx, bwImage *frm ) { return false; numFrames_++; glEnable( GL_TEXTURE_2D ); glGenTextures( 1, &frameHandles_[idx] ); glBindTexture( GL_TEXTURE_2D, frameHandles_[idx] ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); unsigned char *scaledImg = (unsigned char*)malloc( texWidth_*texHeight_*sizeof(unsigned char) ); gluScaleImage( GL_LUMINANCE, frm->getWidth(), frm->getHeight(), GL_UNSIGNED_BYTE, frm->rawData(), texWidth_, texHeight_, GL_UNSIGNED_BYTE, scaledImg ); glTexImage2D( GL_TEXTURE_2D, 0, GL_LUMINANCE, texWidth_, texHeight_, 0, GL_RGB, GL_UNSIGNED_BYTE, scaledImg ); free( scaledImg ); } bool correlator::addImageFrame( int idx, rgbImage *frm ) { numFrames_++; glEnable( GL_TEXTURE_2D ); glGenTextures( 1, &frameHandles_[idx] ); glBindTexture( GL_TEXTURE_2D, frameHandles_[idx] ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); unsigned char *scaledImg = (unsigned char*)malloc( texWidth_*texHeight_*3*sizeof(unsigned char) ); gluScaleImage( GL_RGB, frm->getWidth(), frm->getHeight(), GL_UNSIGNED_BYTE, frm->rawData(), texWidth_, texHeight_, GL_UNSIGNED_BYTE, scaledImg ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, texWidth_, texHeight_, 0, GL_RGB, GL_UNSIGNED_BYTE, scaledImg ); free( scaledImg ); return true; } void correlator::clearWindow() { if ( visible_ ) glClear( GL_COLOR_BUFFER_BIT ); } float correlator::correlation( int frame1, int tri1x1, int tri1y1, int tri1x2, int tri1y2, int tri1x3, int tri1y3, int frame2, int tri2x1, int tri2y1, int tri2x2, int tri2y2, int tri2x3, int tri2y3 ) const { /* int twoArea1 = (tri1x2*tri1y3 - tri1y2*tri1x3) + (tri1x1*tri1y2 - tri1y1*tri1x2) + (tri1y1*tri1x3 - tri1x1*tri1y3); int twoArea2 = (tri2x2*tri2y3 - tri2y2*tri2x3) + (tri2x1*tri2y2 - tri2y1*tri2x2) + (tri2y1*tri2x3 - tri2x1*tri2y3); */ int max1 = tri1x1; int min1 = tri1x1; if ( max1
tri1x2 ) min1=tri1x2; if ( max1
tri1y2 ) min1=tri1y2; if ( max1
tri1x3 ) min1=tri1x3; if ( max1
tri1y3 ) min1=tri1y3; int max2 = tri2x1; int min2 = tri2x1; if ( max2
tri2x2 ) min2=tri2x2; if ( max2
tri2y2 ) min2=tri2y2; if ( max2
tri2x3 ) min2=tri2x3; if ( max2
tri2y3 ) min2=tri2y3; int winSize; if ( max1-min1>max2-min2 ) winSize = max1-min1; else winSize = max2-min2; // Clear the window if ( clearFrames_ ) glClear( GL_COLOR_BUFFER_BIT ); glBindTexture( GL_TEXTURE_2D, frameHandles_[frame1] ); glBegin( GL_TRIANGLES ); glTexCoord2f( (float)tri1x1/(float)imgWidth_, (float)tri1y1/(float)imgHeight_ ); glVertex2i( 1, 0 ); glTexCoord2f( (float)tri1x2/(float)imgWidth_, (float)tri1y2/(float)imgHeight_ ); glVertex2i( winSize, 0 ); glTexCoord2f( (float)tri1x3/(float)imgWidth_, (float)tri1y3/(float)imgHeight_ ); glVertex2i( winSize, winSize-1 ); glEnd(); glBindTexture( GL_TEXTURE_2D, frameHandles_[frame2] ); glBegin( GL_TRIANGLES ); glTexCoord2f( (float)tri2x1/(float)imgWidth_, (float)tri2y1/(float)imgHeight_ ); glVertex2i( 0, 0 ); glTexCoord2f( (float)tri2x2/(float)imgWidth_, (float)tri2y2/(float)imgHeight_ ); glVertex2i( 0, winSize ); glTexCoord2f( (float)tri2x3/(float)imgWidth_, (float)tri2y3/(float)imgHeight_ ); glVertex2i( winSize, winSize ); glEnd(); glFlush(); glPixelTransferf( GL_RED_SCALE, 0.3333f ); glPixelTransferf( GL_GREEN_SCALE, 0.3333f ); glPixelTransferf( GL_BLUE_SCALE, 0.3333f ); glReadPixels( 0, 0, winSize, winSize, GL_LUMINANCE, GL_UNSIGNED_BYTE, localCompBuf_ ); int sum; int sumSqr=0; for ( int y=1; y
correlator.C
Page URL
File URL
Prev
4/50
Next
Download
( 10 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.